Container

The workhorse layout component. Holds any children; semantic tag driven by props.type (section, header, footer, nav, main, aside, form, details, summary, etc.).

The workhorse layout component. Holds any children; semantic tag driven by props.type (section, header, footer, nav, main, aside, form, details, summary, etc.).

Container is the default for any layout block. The moment you need to repeat children from data, switch the resolved type to Data (same DOM, adds dataSource).

Key files

Props

PropNotes
typecontainer (default), section, page, header, footer, nav, aside, main, form, component, imageContainer, details, summary. Drives the HTML tag. page = top-level page Container (must be a child of ROOT, exactly one with isHomePage: true per multi-page tree).
isHomePage / is404Pagebool. On a type: "page" Container only.
anchorstring. HTML id for in-page links (becomes id="...").
tabGroupstring. Tab group identifier — Buttons can target this via show-hide.
action / method / targetwhen type: "form".
idExplicit DOM id (separate from craft node id; craft node IDs do NOT appear as DOM ids).
role, aria-*Accessibility.
clickClickControl partial — alternative to Button.action for clickable cards.
seoPer-page SEO when type: "page".
backgroundBackgroundProps (image, position, size).
attrsPass-through DOM attrs.
handlersCustom JS event handlers.
className, root, overflowStandard.

Children: any.

When to use (vs alternatives)

  • Container — plain layout, semantic wrapper.
  • Data — when the section binds to a connector or a parent item array. Same output, adds dataSource.
  • Header / Footer — semantic chrome at the top/bottom of a page. Behave like Container with a fixed type.
  • Form — when you need form submission. Container with type: "form" works for plain action/method, but Form adds the SDK submission pipeline.

Gotchas

  • attrs.id writes a DOM id attribute; craft node id does not. Use attrs: { id: "my-modal" } (or the dedicated id prop) for show-hide / anchor targets.
  • Negative margin + w-full does not widen — for edge-bleed inside a padded card use w-[calc(100%+(var(--space-lg)*2))] -mx-space-lg max-w-none.
  • dataSource on a Container does nothing — convert to Data.

Related