Open orders
128 waiting
One stylesheet · zero runtime
LayoutKit is a readable vocabulary of lk-* wrappers — stack, switcher, sidebar, grid, and snap scrolling — used inside real HTML landmarks. Version 2.0 measures those layouts from their own container. Version 2.2 keeps that, and lines overflowing centered content up at the start where safe exists.
Live, no JavaScript
Each example is the same markup twice: a 16rem frame and a 36rem frame. On a phone, scroll the wide frame sideways. Nothing on this page listens for resize.
Below 30rem each child takes the full width. Above that, the two children share one row.
<lk-switcher gap="sm">
<article>
<h3>Open orders</h3>
<p>128 waiting</p>
</article>
<article>
<h3>Shipped today</h3>
<p>64 left the dock</p>
</article>
</lk-switcher>
16rem
128 waiting
64 left the dock
36rem, scroll sideways
128 waiting
64 left the dock
The tinted block is the side. The notes take the rest of the row, then drop below.
<lk-sidebar gap="sm" style="--lk-sidebar-width: 11rem">
<nav aria-label="Order sections">Sections</nav>
<p>Morning notes stay beside the sections.</p>
</lk-sidebar>
16rem
Morning notes stay beside the sections while the frame is wide enough.
36rem, scroll sideways
Morning notes stay beside the sections while the frame is wide enough.
Fixed columns stack from the grid’s own width. The middle berth uses the tint already on this site.
<lk-grid cols="3" gap="sm">
<article>North berth</article>
<article>South berth</article>
<article>West berth</article>
</lk-grid>
16rem
12 ships
7 ships
3 ships
36rem, scroll sideways
12 ships
7 ships
3 ships
A horizontal scroll area snaps its children. Swipe or use the keyboard. No carousel script.
<lk-scroll-area direction="horizontal" slide="peek" tabindex="0">
<article>Monday manifest</article>
<article>Tuesday delay</article>
<article>Wednesday clearance</article>
</lk-scroll-area>
North berth, 12 ships.
South berth, weather hold.
West berth, released.
One CSS file of layout primitives, 85,031 bytes (13,626 gzipped). No runtime, no dependencies, no custom-element registration. Rules live in @layer layoutkit, so an unlayered rule you write later wins.
Not a component library, design system, or a substitute for semantic HTML. Not a button kit, form kit, theme, icon set, or JavaScript app shell. Not a utility class for every property.
Version 2.0.0
Tags, attribute names, and the export path are unchanged. The measurements are not. Read MIGRATION.md before upgrading. The file in the repo is packages/layoutkit/MIGRATION.md.
lk-switcher, lk-sidebar, and lk-grid set container-type: inline-size. A switcher stacks below 30rem. A grid with fixed cols stacks below 32rem. responsive and min stay auto-fit. Opt out with container="off".
Named gaps resolve through --lk-space-*, which is var(--space-*, var(--lk-space-fluid-*)). A host --space-* token still wins. --lk-space-static-* keeps the old rem steps.
lk-scroll-area direction="horizontal" snaps its children unless snap="off". Vertical snapping still requires snap. The region needs tabindex="0" and a name when it must be a keyboard stop.
One child in a row or stack is centered unless adapt="off". lk-center covers a positioned parent unless overlay="off". Five or more switcher children each take a row. The default limit is 4.
width="xl" is 56rem.The previous 64rem step is width="2xl". width="3xl" is 80rem. This page is an lk-box at 3xl. Widen the window to see the steps.
xlVersion 2.2.0
Centering is the complaint that does not go away, and so is a layout that flips while the keyboard still walks the old order. 2.2.0 lines overflowing centered content up at the start, where safe exists, so the first word stays reachable. Where reading-flow exists, a reversed row is read in the order you see. Firefox and Safari keep the source order, which is why spot does not move anything there. Scroll the notes. The title sticks. A hairline appears only where scroll-state queries exist.
Section title
First note under the title.
Second note, so the region can scroll.
Third note. The line needs a scroll-state query.
Fourth note is the end.
Fifth note keeps the title above the text.
Sixth note is the last one.
Install
The public registry’s latest is 1.3.2, published 5 July 2026. This site loads /layoutkit.css from the 2.2.0 build. A package CDN would still serve 1.3.2. If that file does not load, nothing in JavaScript rebuilds the layout.
npm install layoutkit-css@2.2.0
<link rel="stylesheet" href="/layoutkit.css">
Browsers do not treat lk-* tags as landmarks, headings, or controls. Keep those elements native.
<main>
<section aria-labelledby="dashboard-heading">
<lk-stack gap="lg">
<h1 id="dashboard-heading">Dashboard</h1>
<lk-grid cols="3">
<article>
<h2>Open orders</h2>
<p>128</p>
</article>
</lk-grid>
</lk-stack>
</section>
</main>
Use a button or an a for actions. Do not put click handlers on lk-* elements.
Do not add ARIA roles to make a layout wrapper seem semantic. If it has no role, it usually needs no ARIA.
Focus order follows source order in Firefox and Safari. Where reading-flow exists, a reversed row follows the picture. The switcher does not reverse flex-direction when it stacks. Scroll regions that must be keyboard stops need tabindex="0" and a name.
Reveal and disclosure motion turn off under reduced motion. The content stays visible, and scroll buttons never replace the keyboard.