Skip to main content
Themes and layouts are the two tools the SDK gives you for consistency at scale. A theme controls the color palette and fonts across every slide in a deck — change the theme and all slides update together. A layout is a reusable slide template: static chrome elements like logos and backgrounds live in the layout, while named placeholder slots mark where variable content goes. You fill those slots per slide when you create it.

Themes

A theme is a set of CSS :root custom properties — --slide-* variables — that the renderer applies to every slide in a deck. You define a theme once, apply it to a deck, and from that point every layer that references a theme token (like var(--slide-brand)) picks up the right color and font automatically.

Creating a theme

You can create a theme with structured colors and fonts objects, or by writing raw CSS if you need full control.

Applying a theme to a deck

Use applyTo in the themes.create() call to attach the theme to a deck in one atomic operation:
Or apply a theme to an existing deck by updating it:

Theme color tokens

The SDK exports a colorRef() helper that resolves a token name to the corresponding CSS variable string. Use it anywhere a layer field accepts a color value — fill, color, backgroundColor, and so on — to bind the layer to the theme rather than hard-coding a hex value.
Use it in a layer:

Theme tokens reference

Color tokens

Font tokens

The heading and body tokens are set via the fonts.heading and fonts.body fields in the structured theme spec. The title token can be set independently in raw CSS when the title style requires a different font family. You reference font tokens indirectly through the style field on text layers — style: 'title' uses --slide-font-title, style: 'h1' uses --slide-font-heading, style: 'body1' uses --slide-font-body.

Layouts

A layout is a reusable slide template. It contains static chrome — a background, logo, decorative shapes — alongside named placeholder slots. Each placeholder marks a region where variable content goes. When you create a slide from a layout, you fill the placeholders by name and the SDK merges the static chrome and the filled content into a single request.

Creating a layout

Call ablo.layouts.create() with the layoutId of the container (the same layoutId you’d assign to a deck), a name, and a layers array. Any layer that should be a placeholder gets a placeholder field — either a bare name string or a PlaceholderSpec object.

Placeholder types

The type field in a PlaceholderSpec describes the kind of content the slot expects. It drives how the renderer displays the empty slot and how master layout inheritance works (a layout’s title placeholder covers the master’s title placeholder). If you omit it, the SDK infers the type from the layer’s content type.

Creating slides from a layout

Call ablo.layouts.createSlide() with the LayoutResource returned from layouts.create(), the deckId, an order, and a fill map keyed by placeholder name.
For more complex fills — bullets, charts, images — use the content builders:
If you reference a placeholder name in fill that doesn’t exist on the layout, layouts.createSlide() throws immediately with a clear error listing the available placeholder names. Double-check spelling — placeholder names are case-sensitive.

Master layouts

A master layout is a special template in a container whose chrome is inherited by every other layout in that container. Mark a layout as master by passing master: true when creating it. Slides that opt out of master compositing can set showMasterShapes: false.

Full example: theme + layout together

When you pass a LayoutResource directly to layouts.createSlide(), the SDK validates your fill keys against layout.placeholders at the call site — before any network request is made. You’ll get a descriptive error immediately if a key doesn’t match, rather than a server-side failure.