Skip to main content
A layout is a reusable slide template. It holds the static chrome — background colors, logo images, decorative shapes — plus named placeholder slots that mark where variable content goes. You create a layout once, then call layouts.createSlide() to stamp out a fully-populated slide by filling each slot by name. This two-phase approach keeps your design consistent across a deck while letting you swap content programmatically.

How layouts work

Layouts live inside a layout container, identified by a layoutId. Every deck has its own layout container (accessible via deck.layoutId after creation), so layouts you define for one deck stay scoped to that deck. When you create a layout with layouts.create(), you define:
  • Static layers — content that appears on every slide stamped from this layout (a header bar, a company logo, a footer).
  • Placeholder layers — layers tagged with a placeholder name. When you call layouts.createSlide(), you supply a fill map that replaces each placeholder with real content.
The layoutId you pass to layouts.create() is the container id — it comes from the deck’s layoutId field. It is not the layout’s own id (which is returned from layouts.create()).

PlaceholderSpec

Every layer in a layout can carry a placeholder field. Pass a bare string for a simple name, or a full PlaceholderSpec object to add a visible hint and an explicit type:
The type drives render-family selection and master inheritance. If you omit it, the SDK infers it from the layer’s content type (a text layer becomes 'body', a bar layer becomes 'chart', an image layer becomes 'image').

Master layouts

Setting master: true on a layout makes it the master for its container. Every other layout in the same container automatically inherits the master’s layers. Master inheritance deduplicates by placeholder type, so a layout’s own title placeholder overrides the master’s title without duplicating it.

Complete walkthrough

1

Create the deck

You need a deck before you can create a layout, because the layout’s container id comes from the deck.
2

Retrieve the deck to get its layoutId

The DeckResource returned by decks.create() includes a layoutId field (which may be null for a brand-new deck before the server provisions the container). A retrieve() call returns the authoritative record after it has been provisioned.
3

Create a layout template with placeholder slots

Define the template layers. Each layer that should be filled at instantiation time gets a placeholder name.
The returned LayoutResource includes a placeholders map keyed by name — you will use this object directly in the next step.
4

Instantiate a slide from the template

Call layouts.createSlide() and supply fill entries keyed by placeholder name. The SDK creates the slide and all filled layers in one atomic commit.

Reusing a layout across multiple slides

Once you have a LayoutResource in hand, you can stamp out as many slides as you need. Each call to layouts.createSlide() is independent — a failure on one slide does not affect the others.

Layout management

After creation, you can update or delete a layout and its individual layers.
Deleting a layout does not delete slides that were already stamped from it. Those slides keep their filled layers and continue to render normally.