Skip to content

ReferenceAPI

Shapes, charts and tables

The objects on a slide, and what can be changed on each.

Shapes, charts and tables.md

The objects on a slide, and what can be changed on each. The same text agents read through help().

frame: Frame

The frame in px: its own, or the layout’s when it inherits from a placeholder.

id: string

Agent-facing anchor, e.g. sh_7Q2M4K9A.

name: string

Role name, e.g. “title” or “kpi-value”; shown in inspect() and the selection pane.

options: Readonly<ShapeInit>

The options the shape was built from, including any update().

replaceText(find: string | RegExp, replacement: string): number

Replaces text, keeping paragraphs, runs and styles: shape.replaceText("48%", "49%"). A string matches literally; a RegExp can use $1 references. Returns the number of replacements.

shape.replaceText("48%", "49%")
setText(text: NonNullable<ShapeOptions["text"]>): this

Replaces the shape’s text (a string, paragraphs or runs), keeping its box and look: shape.setText("Q3 at a glance").

Options: ShapeOptions.

shape.setText("Q3 at a glance")
text: string

The text, one line per paragraph (“” for a shape without text).

update(changes: Partial<ShapeOptions>): this

Changes some options and keeps the rest: shape.update({ frame: { x: 40, y: 80, w: 400, h: 60 } }). The shape keeps its id; connectors attached to it follow it.

Options: ShapeOptions.

shape.update({ frame: { x: 40, y: 80, w: 400, h: 60 } })
id: string

Agent-facing anchor, e.g. ch_7Q2M4K9A.

options: Readonly<ChartOptions>

The options the chart was built from, including any update().

type: ChartType

The chart type, e.g. “column”, “line” or “pie”.

update(changes: Partial<ChartOptions>): this

Changes some options and keeps the rest, e.g. new series or a title. Axes merge axis by axis and label or legend objects merge, so { axes: { y: { min: 2 } } } keeps the y format.

Options: ChartOptions.

{ axes: { y: { min: 2 } } }
id: string

Agent-facing anchor, e.g. tb_7Q2M4K9A.

options: Readonly<TableOptions>

The options the table was built from, including any update().

update(changes: Partial<TableOptions>): this

Changes some options and keeps the rest, e.g. new rows or a frame.

Options: TableOptions.

from: Connectable & { frame?: Frame }

The elements it joins.

id: string

Agent-facing anchor, e.g. sh_7Q2M4K9A.

options: ConnectOptions

How it was drawn: kind, line, arrow and sides.

to: Connectable & { frame?: Frame }

The element the arrow points at.

children: SlideElement[]

The members, back to front.

id: string

Agent-facing anchor, e.g. sh_7Q2M4K9A.

name: string

Role name for the group.

id: string

Agent-facing anchor, e.g. im_7Q2M4K9A.

options: Readonly<ImageOptions>

The options the picture was built from, including any update().

update(changes: Partial<ImageOptions>): this

Changes some options and keeps the rest, e.g. a new source, frame or crop.

Options: ImageOptions.