Margin layout
Numbered items with margin notes for product reading pages: the number in the left margin in tabular display figures, the note (the article cited, « See in the document ») in the right margin from 64 rem and under the item below it.
import { MarginLayout, MarginItem } from "@krizaka/ui/margin-layout";Web only — React, from @krizaka/ui/margin-layout. Beta: its API may still change in a minor version.
- Mobile · ✗ to build. A phone is always the folded layout (the note under the item); the apps compose it from a numbered List until a screen asks for a twin. issue #645
Why it is here. Yomizaka (krizaka/yomizaka#314) for its report and check flow, then any product that reads numbered findings.
When to use
- A report or a check flow read from top to bottom, where each numbered point has a source to show beside it (a finding and its clause).
- Step flows whose steps carry a short note that must not interrupt the text.
When not to use
- A sentence-long footnote on a Cahier page.Use instead: Footnote & caption
- A label and a value, many times.Use instead: Description list
- Independent entry points.Use instead: Card grid
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { MarginLayout, MarginItem } from "@krizaka/ui/margin-layout";Examples
Findings with their sources
Three numbered findings of a lease check, each with the clause it cites in the margin.
A step flow
Numbered steps, one with a note and one without.
Props
MarginItem
One item: its number, its content and, optionally, its margin note.
| Prop | Type | Default | Description |
|---|---|---|---|
childrenrequired | ReactNode | — | The item's content. |
numberrequired | ReactNode | — | The number shown in the left margin (« 1 », « 02 »). Decorative: the list already announces the position. |
note | ReactNode | — | The note shown in the right margin from 64 rem, and under the item below it (the article cited, « See in the document »). |
MarginLayout
The list of numbered items.
| Prop | Type | Default | Description |
|---|---|---|---|
childrenrequired | ReactNode | — | The MarginItems, in reading order. |
Accessibility
- An ordered list: the position of each item is announced by the list, so the visible number is hidden from assistive tech to avoid saying it twice.
- The reading order is the number, the text, then the note, whichever margin the note is drawn in.
- The accent figure is large text (≥ 3:1); the note uses the secondary text role (≥ 4.5:1).
Keyboard
| Keys | Action |
|---|---|
| Tab | Reaches whatever interactive content the items hold; the layout adds no stop. |
Best practices
- Keep a note to one or two lines: it sits beside the text on a desktop and under it on a phone.
- Number in reading order (1, 2, 3); the figures are tabular so a column of them lines up.
- Pass the words from your messages; the package ships none.
- Put the page's heading outside the list: the list holds only the items.
Related components
Generated from the code of @krizaka/ui 3.63.1: its meta.ts, its examples and its types.Edit this documentation on GitHub