Layout primitives
| Class | What it does | Custom properties |
|---|---|---|
.stack | Vertical flow with a gap | --stack-gap |
.cluster | Wrapping inline group | --cluster-gap, --cluster-justify, --cluster-align |
.grid | Auto-fit responsive grid, no media queries | --grid-min, --grid-gap |
[data-scroll="inline"] | Scroll container for content wider than the screen, such as a data table | None |
[data-scroll="block inline"] | Also scrolls vertically, at most --dui-size-pane (the viewport) tall, so a sticky table header stays in view | None |
<div class="grid" style="--grid-min: 12rem">…</div>
On a ul or ol, the primitive also removes list markers and padding.
Page layouts
Larger layouts for application screens, each one attribute on a wrapper, live in css/layout/ too and
are shown in examples/layouts/:
| Attribute | What it does |
|---|---|
data-list-detail | A list of links (aria-current on the selected one) beside a labelled detail; the detail scrolls on its own when side by side |
data-split="[1:1 | 1:2 | 2:1]" | Two regions side by side at a ratio |
data-dashboard, data-dashboard-tile="wide | full" on a tile | Headed tiles on raised surfaces that reflow without media queries |
data-action-bar | A form's buttons in a bar that sticks to the bottom of the scroll area and never hides the focused field |
data-app-shell, data-app-shell="contained" | The frame of an application: <header>, a primary sidebar (<nav>), <main>, an optional auxiliary <aside> and <footer> in named grid areas; <dui-app-shell> makes the sidebars collapsible and drawers when narrow |
Each one is side by side when its wrapper is wide and stacked when it is narrow, from 320px up, and keeps
source order (the reading and Tab order) in both. A settings page needs no API of its own. It is a
data-list-detail of in-page links beside data-form-sections with a data-action-bar
(example).
- Our choice: layouts and organisms switch with a container query on their own wrapper, not a media query, because they sit in regions of any width: a page, a split, the main area of an app shell. Media queries are kept for decisions about the whole viewport. A container query condition cannot read a custom property, so each breakpoint is a length written in the file header.
- Our choice: list-detail items are links to the item's own URL, not buttons that swap content, so history, bookmarks and the no-JavaScript case work.
- Our choice: the sticky action bar reserves its height as
scroll-padding-block-endon every ancestor of its form, so whichever one scrolls keeps the focused field clear of the bar (2.4.11 Focus Not Obscured (Minimum), technique C43). - Our choice: the app shell is the landmarks HTML already has, in source order, placed with
grid-template-areas. Parts are recognized by element and position, so none needs an attribute (APG Landmark Regions, explainer). Without JavaScript both sidebars are always shown (stacked when narrow) and the toggles stayhidden, so no button does nothing. - Our choice: one copy of each sidebar. Beside main it is a plain landmark that its toggle hides with
hidden. On a narrow shell<dui-app-shell>moves the same element into a modal drawer<dialog>while the drawer is open, so screen readers hear "dialog" only while it is one and the navigation is never duplicated. - Our choice: the shell switches on its own width (container queries at 48rem for the primary sidebar
and 64rem for the auxiliary one, and a
ResizeObserverin the element), and<main>and each sidebar are named size containers, so a contained shell works anywhere and the layouts inside main follow main's width. - Our choice: the sidebar navigation is the nav molecule (
data-nav="vertical") with optional decorative icons, not a tree view. An APG Tree View is for hierarchies users navigate as data (file trees) with roving focus and arrow keys. Site navigation is links, so disclosure groups and links (APG Disclosure Navigation) are the right semantics. - Our choice: the selected item of a list-detail is marked like a selected table row: a
--dui-border-width-emphasisbar on its leading edge, a tint and bold text, with the bar drawn inHighlightin forced colors mode (1.4.1, 1.4.11). - Our choice: splits have a fixed ratio and no draggable divider. A resizable one would follow the APG Window Splitter pattern (explainer).
Wrap any table that may not fit a 320px screen in data-scroll="inline", named by its caption:
<section data-scroll="inline" aria-labelledby="orders-caption" tabindex="0">
<table>
<caption id="orders-caption">Recent orders</caption>
…
</table>
</section>
tabindex="0" makes it scrollable from the keyboard
(2.1.1 Keyboard, axe
scrollable-region-focusable),
and a named <section> is a region landmark, so
screen reader users hear what that focus stop is. Our choice: <section> rather than
<div role="region">, because the native element already has the role. Data tables
may scroll sideways under 1.4.10 Reflow;
the page itself must not. Never set display: block on the <table> instead. It can drop table
semantics in some browsers (Adrian Roselli).
A <pre> already scrolls (overflow-x: auto). Authors MUST give every <pre> (and any
data-scroll="inline" container) tabindex="0" so it can be scrolled from the keyboard.