Skip to main content
A deck is a presentation. A slide belongs to exactly one deck, and a layer is a content element positioned on a slide. These three resources — deck, slide, layer — are the building blocks of everything the SDK produces. You can describe the entire tree in a single call, or you can build it incrementally by adding slides and layers one at a time; both approaches are fully supported and result in the same Ablo presentation.

The declarative pattern

The fastest way to create a deck is to pass its entire structure — slides, layers, and all — to ablo.decks.create() in a single call. The entire tree is saved atomically: either everything is written or nothing is. There is no partial state to clean up if something goes wrong.

The imperative pattern

When you need to add slides or layers after a deck is already created — for example, appending new slides in a loop or reacting to user input — use the individual ablo.slides.create() and ablo.layers.create() methods.
You can mix both patterns. Create a deck declaratively for its first set of slides, then use ablo.slides.create() to append slides dynamically as your data grows.

Client-minted IDs

All resource IDs are generated on the client side — before the request is sent to the API. This means every ID returned from decks.create(), slides.create(), and layers.create() is available synchronously in the returned object without any extra round-trip. You can hold onto a layer ID immediately and use it to push updates in every subsequent run.

Resource fields

DeckResource

id — unique deck identifier
title — display name
layoutId — applied layout container, or null
themeId — applied theme, or null
slides — ordered array of SlideResult

SlideResource

id — unique slide identifier
deckId — parent deck
title — display name
order — integer position in the deck

LayerResource

id — unique layer identifier
slideId — parent slide
type — the persisted layer type (e.g. text, chart, shape)

Slide ordering

The order field on a slide is an integer that determines where the slide appears in the deck. Slides are sorted ascending by order, so order: 0 is the first slide. When you use the declarative ablo.decks.create(), the SDK assigns order automatically based on the position of each slide in the slides array. When you call ablo.slides.create() imperatively, you supply order yourself — typically set it to the current slide count so the new slide lands at the end.

Slide backgrounds

You set a slide’s background using the background field in the slide spec. You can pass a raw CSS string, a hex color, or use the structured background builders exported from @abloatai/decks.

Slide size presets

The default slide canvas is 1920 × 1080 pixels (16:9 widescreen). You can change the size per slide using the size field, which accepts a preset ID.
All layer coordinates — the x, y, w, and h fields inside at — are expressed in pixels within the slide’s canvas dimensions. For a standard 16:9 slide, that means x and w are in the range 0–1920 and y and h are in the range 0–1080.

The coordinate system

Every layer is positioned using an at field that specifies a bounding box in slide-canvas pixels.
The origin (0, 0) is the top-left corner of the slide. On a default 16:9 slide, a layer at { x: 160, y: 120, w: 1600, h: 840 } leaves an 160 px margin on the left and right and sits 120 px from the top. You can also supply an optional rotation in degrees.