Skip to content

ReferenceAPI

Slides

A slide's shapes, charts, tables, pictures, placeholders and notes.

Slides.md

A slide’s shapes, charts, tables, pictures, placeholders and notes. The same text agents read through help().

background: string | undefined

Background paint (color token, hex or gradient); undefined inherits the layout’s.

bringForward(target: SlideElement | string): void

Moves an element one step forward.

Options: SlideElement.

bringToFront(target: SlideElement | string): void

Moves an element in front of everything else.

Options: SlideElement.

Native charts: slide.charts.add("column", { frame, categories, series }).

slide.charts.add("column", { frame, categories, series })
add(type: ChartType, options: ChartOptions): Chart

Adds a native, editable chart. “column” is vertical bars, “bar” horizontal bars: charts.add("column", { frame, categories: ["Q1", "Q2"], series: [{ name: "ARR", values: [4, 6] }] }).

Options: ChartType, ChartOptions.

charts.add("column", { frame, categories: ["Q1", "Q2"], series: [{ name: "ARR", values: [4, 6] }] })
items: Chart[]

Charts, back to front.

length: number

How many there are.

clear(): void

Removes everything on the slide (shapes, charts, tables, pictures, connectors, and what was put in its placeholders) and keeps its layout, background and notes, so it can be composed again: slide.clear(); compose(slide, h(TitleBullets, { … })).

slide.clear(); compose(slide, h(TitleBullets, { … }))
comment(text: string, options: { target?: SlideElement | string; at?: { x: number; y: number }; author?: string; replies?: Array<string | { text: string; author?: string }>; resolved?: boolean; } = {}): SlideComment

Starts a comment thread, on the slide or on one of its objects: slide.comment("Is this audited?", { target: chart, replies: ["Yes, Q3 close"] }). The author is the deck’s current one (deck.comments.setAuthor) unless you name another.

Options: SlideElement.

slide.comment("Is this audited?", { target: chart, replies: ["Yes, Q3 close"] })
comments: SlideComment[]

Comment threads on this slide, oldest first.

connect(from: SlideElement | string, to: SlideElement | string, options: ConnectOptions = {}): Connector

Draws a connector glued to two elements, so it follows them when they move in PowerPoint. slide.connect(a, b, { kind: "elbow" }). The connector sits just behind both elements.

Options: SlideElement, ConnectOptions.

slide.connect(a, b, { kind: "elbow" })
elements: SlideElement[]

Every element in z-order, back to front (placeholders included).

export(options: { format: "layout" }): SlideLayoutExport

The slide as data. format: "layout" returns every element’s box and every wrapped line of text, exactly as rendered, so placement and overflow can be checked without looking at pixels.

find(target: SlideElement | string): SlideElement | undefined

Finds an element by reference or anchor id (e.g. “sh_7Q2M4K9A”), including inside groups.

Options: SlideElement.

footer: boolean

Set to false to hide the deck footer on this slide.

group(members: Array<SlideElement | string>, options: { name?: string } = {}): Group

Groups top-level elements so they move and scale together. The group takes the back-most member’s place.

Options: SlideElement.

id: string

Agent-facing anchor, e.g. sl_7Q2M4K9A.

Pictures: slide.images.add({ source, frame, fit: "cover" }).

slide.images.add({ source, frame, fit: "cover" })
add(options: ImageOptions): Picture

Adds a picture from a path, bytes, data URL or SVG.

Options: ImageOptions.

items: Picture[]

Pictures, back to front.

length: number

How many there are.

layout: Layout

The layout this slide uses.

notes: TextInput | undefined

Speaker notes, shown in presenter view.

The layout’s placeholder slots: slide.placeholders.get("title").setText("Q3").

slide.placeholders.get("title").setText("Q3")
get(name: string): PlaceholderSlot

A placeholder slot by name, e.g. “title”, “body”, “left”, “picture”.

names: string[]

Names of the placeholders this slide’s layout offers.

remove(target: SlideElement | string): void

Deletes an element (by reference or anchor id). Connectors attached to it go too, since they would be left pointing at nothing. Inside a group, the group must keep at least two members.

Options: SlideElement.

render(options: RenderOptions = {}): Promise<Uint8Array>

Renders this slide to an image (PNG by default), as the agent’s preview.

Options: RenderOptions.

sendBackward(target: SlideElement | string): void

Moves an element one step back.

Options: SlideElement.

sendToBack(target: SlideElement | string): void

Moves an element behind everything else.

Options: SlideElement.

Shapes and text boxes: slide.shapes.add({ frame, text, fill }).

slide.shapes.add({ frame, text, fill })
add(options: ShapeOptions): Shape

Adds a shape, text box or custom path. Invalid options throw immediately.

Options: ShapeOptions.

items: Shape[]

Shapes and text boxes, back to front.

length: number

How many there are.

Native tables: slide.tables.add({ frame, rows }).

slide.tables.add({ frame, rows })
add(options: TableOptions): Table

Adds a native, editable table.

Options: TableOptions.

items: Table[]

Tables, back to front.

length: number

How many there are.

element: SlideElement | undefined

The element filling this slot, if any.

frame: Frame

The layout’s frame for this slot, in px.

name: string

The slot name, e.g. “title”, “body” or “picture”.

set(content: PlaceholderContent): SlideElement

Fills the slot from any PlaceholderContent value.

Options: PlaceholderContent.

setImage(source: ImageOptions["source"], options: Omit<ImageOptions, "source" | "frame"> = {}): Picture

Fills a picture or content slot with an image, fitted to the slot’s frame.

Options: ImageOptions.

setText(text: TextInput, options: { textStyle?: string | TextStyle; textBox?: TextBoxOptions; frame?: Frame } = {}): Shape

Fills the slot with text. The text inherits the layout’s position and master styles.

Options: TextInput, TextStyle, TextBoxOptions, Frame.