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 uniquement — React, depuis @krizaka/ui/margin-layout. Bêta : son API peut encore changer à une version mineure.
- Mobile · ✗ à construire. 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
Pourquoi il est là. Yomizaka (krizaka/yomizaka#314) for its report and check flow, then any product that reads numbered findings.
Quand l’utiliser
- 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.
Quand ne pas l’utiliser
- A sentence-long footnote on a Cahier page.À la place : Footnote & caption
- A label and a value, many times.À la place : Description list
- Independent entry points.À la place : Card grid
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { MarginLayout, MarginItem } from "@krizaka/ui/margin-layout";Exemples
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 | Défaut | Description |
|---|---|---|---|
childrenrequis | ReactNode | — | The item's content. |
numberrequis | 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 | Défaut | Description |
|---|---|---|---|
childrenrequis | ReactNode | — | The MarginItems, in reading order. |
Accessibilité
- 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).
Clavier
| Touches | Action |
|---|---|
| Tab | Reaches whatever interactive content the items hold; the layout adds no stop. |
Bonnes pratiques
- 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.
Composants liés
Générée depuis le code de @krizaka/ui 3.63.1 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub