Vanilla Breeze

layout-canvas

Elevated surface container with background, radius, shadow, and padding. Use the data-canvas attribute on semantic elements or the layout-canvas wrapper element.

Attributes

Attribute Values Default Description
data-canvas (empty), flush, elevated (empty) Applies canvas surface styling. Value sets the variant.
data-variant flush, elevated - Variant for the <layout-canvas> element form.
data-layout-max narrow, content, wide, prose - Maximum inline size constraint.
data-layout-padding none, s, m, l, xl l Override default padding.
data-canvas-depth 1, 2 - Ghost card stacking effect (not available on flush).

How It Works

data-canvas is an attribute you add to any semantic element to give it an elevated surface — background, border-radius, box-shadow, and padding. The <layout-canvas> custom element is an alternative wrapper for when you need a non-semantic container.

Both forms share the same CSS and consume the same --canvas-* design tokens used by data-backdrop, so theme overrides apply to both systems.

Attribute Form (Preferred)

Add data-canvas directly to a semantic element. No wrapper needed.

Element Form

Use <layout-canvas> when you need a non-semantic wrapper around multiple children.

Variants

Flush

No border radius or shadow. Edge-to-edge surface.

Elevated

Larger radius and dramatic shadow for emphasis.

Width Constraints

Use data-layout-max to constrain the canvas width. It auto-centers with margin-inline: auto.

Nested Canvases

Nested canvases automatically use --color-surface-raised for visual hierarchy.

Ghost Card Depth

Add stacked-paper shadows beneath the canvas for a layered effect. Not available on the flush variant.

Multiple Canvases

Unlike data-backdrop which styles body-level regions implicitly, data-canvas works on any element — so you can have multiple independent canvases on the same page.

Relationship to data-backdrop

data-canvas and data-backdrop are complementary:

  • data-backdrop styles body > main/header/footer/nav/aside implicitly
  • data-canvas is for explicit, per-element canvas surfaces
  • Both consume the same --canvas-* tokens
  • A page can use both simultaneously

Mobile Behavior

At <640px, all canvases automatically go flush — no border radius, no shadow, reduced padding. This matches data-backdrop mobile behavior.

Related