elements
Start Docs Blog Demos UI Pricing
Elements Manual
  • Getting Started
  • CLI
  • Build
  • Browser
  • Packages
  • TypeScript
  • Elements HTML
  • Assets
  • RPC
  • Router
  • Session
  • Database
  • Migrations
  • LiveTable
  • Channel
  • Jobs
  • Email
  • Payments
  • JSON
  • Async
  • Style
    • Install
    • Tokens
    • Base elements
    • Typography
    • Layout
    • Components
    • Utilities
    • Theming
    • Overriding
    • Email
    • Reference
  • UI
  • JSOC
  • Config
  • Tests
  • Logs
  • Deploy
  • Editors
  • Recipes
  • Licenses
  • Issues
  • Changelog
Manual / Style/ Layout

Layout

elements man style/layout

On This Page

  • Layout containers set spacing
  • Stack, cluster and row
  • Page structure
  • App shell
  • Helpers
  • Sizing media
  • Phone Widths

The layout classes are containers that position and space their children. This is layout.css in @layer components.

Layout containers set spacing

The system has one rule for spacing:

Layout containers set the space between elements. Components never set outer margins.

No component in the design system puts a margin on its outer element. To put space between two elements, wrap them in a .stack or .cluster, whose gap sets the space. This keeps components portable. The same card works inside any layout because it never assumes a margin.

Stack, cluster and row

.stack: vertical flow with a consistent gap between children. Gap variants is-xs / is-sm / is-md / is-lg / is-xl / is-2xl step the gap up.

Stack
<div class="stack is-lg"> <h2>Account</h2> <p>Manage your profile and billing.</p> <button class="is-primary">Save</button> </div>

.cluster: horizontal flow that wraps, vertically centered. For rows of tags, buttons, or metadata that should wrap on narrow screens. Gap variants is-xs, is-sm, is-md, is-lg, is-xl.

.row: horizontal flex that does not wrap. Alignment variants is-baseline / is-start / is-end / is-stretch (default is centered).

All three clear their children's block margins, since the gap does the spacing. They leave the element's own padding alone, so a .stack can go straight on a <fieldset>, a card, or a panel. On a <ul> or <ol> they also drop the list markers and indent, for a nav or a menu built from a list.

Page structure

.page-shell: a width-constrained, centered page container with a gutter. Width variants:

Every width is spelled out. Pick by the number, not by the word: is-narrow is a phone-width column, and it is the wrong choice for most pages.

Variant Max width Use for
is-narrow --container-sm (24rem / 384px) A sidebar or a single narrow card. Not a page.
is-form --container-2xl (42rem / 672px) A form, a list, a settings page. The usual choice for an app page.
is-prose --container-prose (65ch) Running text.
is-marketing --container-5xl (64rem / 1024px) A landing page.
(default) --container-shell (72rem / 1152px) A general app page.
is-wide --container-wide (80rem / 1280px) Tables and dashboards.
is-full none Edge to edge.

One width per site. A site with a header, a nav or a footer puts them and the <main> in one layout template under app/shared/templates/, each on a page-shell of the same width, chosen once there. Every page renders inside it and never sets a shell width of its own: a page on is-form beside one on the default moves the header 240px between them. A page that wants a narrower column narrows its content inside <main> with max-w-2xl or max-w-prose, so its left edge stays on the shell's.

app/shared/templates/site-layout/index.ehtml
<SiteLayout> <div class="app"> <header><div class="page-shell row">…</div></header> <main class="page-shell"><slot/></main> <footer><div class="page-shell">…</div></footer> </div> </SiteLayout>

.page-hero: a hero block at the top of a page with generous top/bottom padding; is-sm / is-lg adjust it. It also sets the vertical spacing of a direct .eyebrow, h1/.display, and .lede inside it, and limits the lede's width to --container-prose (65ch).

.section: a block with vertical padding that separates content areas; is-sm / is-lg adjust the padding. Adjacent sections (.section + .section) get a soft top rule automatically, so stacked sections divide themselves.

Section
<main class="page-shell is-prose"> <div class="page-hero"> <p class="eyebrow">Changelog</p> <h1 class="display">What's new</h1> <p class="lede">Recent releases and fixes.</p> </div> <section class="section">…</section> <section class="section">…</section> </main>

App shell

.app: a full-height shell for an application layout (as opposed to a content page). Its .app-main, or a bare <main>, takes the spare height whatever its position among the shell's children, and every other child keeps its content height. A header above main, a footer below main, or both need no class:

App shell
<div class="app"> <header>…</header> <main class="app-main">…</main> <footer>…</footer> </div>

.app.has-sidebar: adds a sidebar column. The width comes from --sidebar-width (default 240px); set that token to change it. The layout collapses to a single column at 48rem. .app-main is the main content column (a flex column that won't overflow its track).

Sidebar
<div class="app has-sidebar" style="--sidebar-width: 280px"> <aside>…</aside> <div class="app-main">…</div> </div>

.app.is-fixed: the shell is exactly the viewport and never grows, so a row inside it scrolls on its own. Use it when a region scrolls while the chrome around it stays put: a message log under a header with a composer pinned below, a table under a toolbar. Put overflow-y: auto on the element that scrolls. No other rule is needed.

Fixed app
<div class="app is-fixed"> <header>…</header> <div class="app-main"> <ul class="feed" style="overflow-y: auto">…</ul> </div> <footer>…</footer> </div>

Without it the shell is min-height, so it grows with its content: the log runs past the bottom of the window, the composer goes with it, and the feed never scrolls because it was never bounded. is-fixed also lets the main region shrink below its content (min-height: 0).

.app.has-sidebar gives you the two-column grid and the responsive collapse. Fill the <aside> with whatever the app needs: a .stack of links for navigation, a list, a card.

Helpers

  • .center: a flex container that centers its children on both axes.
  • .divider: a visible horizontal rule (a filled 1px bar, not a border). Variants: is-soft / is-strong change the weight, and is-vertical turns it into a vertical divider that stretches inside a .row or .cluster.
Vertical divider
<div class="row"> <span>Draft</span> <span class="divider is-vertical"></span> <span>Edited 2m ago</span> </div>

Sizing media

aspect-ratio and max-height on the same block element do not produce a shorter box of the same width. The browser derives the width from the clamped height, so the box comes out narrower rather than shorter. A banner given aspect-ratio: 21/9; max-height: 32rem renders 1195px wide inside a 1440px page, not full bleed:

Banner
/* narrows the box instead of cropping it */ .banner { aspect-ratio: 21 / 9; max-height: 32rem; } /* fixes the width, lets the image crop */ .banner { width: 100%; height: 32rem; } .banner img { width: 100%; height: 100%; object-fit: cover; }

Give the box its width, or its height, and crop the image to the box with object-fit: cover.

Phone Widths

Every page works at 390px with no sideways scroll. Wide parts of a page keep their full layout on a desktop and use a different layout on a phone:

  • A board or week calendar shows one column at a time. The columns sit in a row that scrolls horizontally with scroll-snap-type: x mandatory, each column scroll-snap-align: start and the full width, and a row of buttons above it names each column and scrolls to it.
  • A wide table scrolls inside its own container (overflow-x: auto on a wrapper), or stacks each row into a card under a @media (max-width: 640px) rule.
  • Anything you drag also has a tap control: a stage select on a card, or move buttons, calling the same update the drop calls.
Board on a phone
@media (max-width: 640px) { .board { scroll-snap-type: x mandatory; overflow-x: auto; } .board > .column { flex: 0 0 100%; scroll-snap-align: start; } }
Prev TypographyNext Components
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026