Foundations
Layout
Eight small primitives that nest: container, section, stack, cluster, grid, sidebar layout, split and centre, and the application frame. They adapt to the width they are given, mostly without media queries.
Examples
Stack and cluster
A stack puts its children in a column with an even gap; a cluster puts them in a row that wraps. Change the gap with .kui-gap-1 to .kui-gap-8.
<div class="kui-stack kui-gap-3">
<div class="kui-card kui-card--compact">First</div>
<div class="kui-card kui-card--compact">Second</div>
<div class="kui-cluster">
<span class="kui-badge kui-badge--ok">Paid</span><span class="kui-badge">Draft</span><span class="kui-badge kui-badge--warn">Due soon</span><span class="kui-badge kui-badge--info">Shared</span>
</div>
</div>
Grid
Equal columns that fit the width: as many as fit at the minimum size (--kui-grid-min), one on a phone.
<div class="kui-grid kui-grid--sm">
<div class="kui-card kui-card--compact">Beograd</div>
<div class="kui-card kui-card--compact">Novi Sad</div>
<div class="kui-card kui-card--compact">Niš</div>
<div class="kui-card kui-card--compact">Kragujevac</div>
<div class="kui-card kui-card--compact">Subotica</div>
</div>
Sidebar layout and split
The sidebar layout keeps a side column and a main column side by side and stacks them when the main column would be too narrow. The split shows two halves from a tablet up.
Left half
Text beside a picture.
<div class="kui-sidebar-layout">
<aside class="kui-card kui-card--flat">Filters</aside>
<div class="kui-card">Results</div>
</div>
<div class="kui-split">
<div class="kui-stack kui-gap-2"><h3 class="kui-h4">Left half</h3><p class="kui-text-muted">Text beside a picture.</p></div>
<div class="kui-card kui-card--flat">Right half</div>
</div>
Split with a ratio
Three parts to two (--3-2), two to three, two to one or one to two. On a phone the parts stack in the order of the markup; --media-first puts the second part first. --from-lg keeps one column until a laptop, for a split whose parts need room.
Three parts
The words take three fifths. On a phone the picture comes first.
<div class="kui-split kui-split--3-2 kui-split--media-first">
<div class="kui-stack kui-gap-2"><h3 class="kui-h4">Three parts</h3><p class="kui-text-muted">The words take three fifths. On a phone the picture comes first.</p></div>
<div class="kui-card kui-card--flat">Two parts</div>
</div>
Containers and sections
A website page is sections; each section holds a container that centres the content at a maximum width with the side gutter.
A section in a band
The container is 48rem wide here (--md); the default is 75rem.
<section class="kui-section kui-section--tight kui-section--band">
<div class="kui-container kui-container--md">
<h3 class="kui-h3">A section in a band</h3>
<p class="kui-text-muted">The container is 48rem wide here (--md); the default is 75rem.</p>
</div>
</section>
Classes and attributes
.kui-container, --lg, --md, --prose, --full- Centred content at a maximum width, with the gutter on both sides.
.kui-section, --tight, --band- Vertical space between parts of a website page; --band adds a surface and lines.
.kui-stack, .kui-cluster (--between, --end, --start, --nowrap)- A column or a wrapping row with an even gap.
.kui-grid (--sm, --lg)- Equal columns that fit. Set --kui-grid-min to choose the column width.
.kui-sidebar-layout (--end)- A side column and a main column that stack when narrow.
.kui-split (--start)- Two halves from 48rem up.
.kui-split--3-2, --2-3, --2-1, --1-2- Other ratios of the two parts.
.kui-split--media-first, --from-lg- On a phone the second part comes first; the split waits for 64rem before it splits.
.kui-phone-only, .kui-wide-only- Shown only under 48rem, or only from 48rem up.
.kui-center- Content centred on both axes.
.kui-gap-1 … .kui-gap-8- The gap of a stack, cluster, grid or layout.
.kui-app, .kui-app__main- The application frame: top bar, side navigation, main column and the phone tab bar, by grid area. See the dashboard recipe.
Breakpoints- sm 40rem, md 48rem, lg 64rem, xl 80rem. Write them as values in media queries; nothing else is allowed there.
Accessibility
- Keep the order of the markup the order of reading; layout changes position, never meaning.
- Use landmarks: one header, nav with a label, main, footer.
Do and do not
Do
- Build a page from these primitives before writing any layout CSS.
- Let content decide the columns (grid), not fixed breakpoints.
Do not
- Do not set widths in pixels on content.
- Do not reorder content with CSS so that the keyboard order jumps.