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-variant flush, elevated flush (no radius or shadow) or elevated (larger radius and shadow).
data-max narrow, normal, wide, prose Max inline size, centered: narrow / normal / wide (--content-* tokens) or prose (65ch).
data-padding none, s, m, l, xl l Padding on all sides.
data-canvas-depth 1, 2 Stacked-paper effect with 1 or 2 sheets behind the surface.

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-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