Example#
| Project | Score |
|---|---|
| Fernlight | 98 |
Usage#
Use a table for data people compare across rows and columns: projects and their scores, invoices, a schedule. The default ledger look has no zebra stripes: a 2 px rule under the head, soft rules between rows and numbers aligned at the end.
- Parts.
Tablewith a requiredTableCaption(hide it visually withcaptionHiddenwhen a heading already says it),TableHeader,TableBody,TableRow,TableHeadandTableCell. - Numbers take
numeric, for tabular figures aligned at the end. - Overflow.
overflow="scroll"(default) puts the table in a labelled region that scrolls sideways and takes focus;overflow="stack"turns rows into blocks on narrow screens, each cell prefixed by itsheader. - Sorting is
TableSortButtonin a head cell. - Layout is not a table. Use
Gridfor cards andSpecStripfor a few facts.
Anatomy#
| Project | Score |
|---|---|
| Fernlight | 98 |
- CaptionNames the table; it labels the scroll region.
.mk-table-caption - Head rowLabel role over a 2 px ink rule.
.mk-table-header - Row48 px at least, soft rules between.
.mk-table-body .mk-table-row - NumberTabular figures, aligned at the end.
.mk-table-cell[data-numeric]
Volume#
Reading layer: identical at every volume.
Quiet
Projects Project Score Fernlight 98 Studio
Projects Project Score Fernlight 98 Press
Projects Project Score Fernlight 98 Rave
Projects Project Score Fernlight 98
Content#
- Column heads are short nouns with units: "Score", "Budget (CAD)".
- One fact per cell; a cell that needs a sentence belongs in a list.
- Empty cells say why ("Not tracked"), never leave a blank people read as zero.
Do and don't#
Do
| Project | Score |
|---|---|
| Fernlight | 98 |
Don't
A table used to lay out a sign-up form in two columns.
Accessibility#
- Every table has a caption (
TableCaption);captionHiddenkeeps it for screen readers only. - The scroll wrapper is a focusable region named by
regionLabel, so keyboard users can scroll it. - Stacked rows keep explicit table roles and print each cell's header.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "compact" | "ledger" | none | |
overflow | "scroll" | "stack" | none | |
stickyFirstColumn | boolean | none | |
captionHidden | boolean | none | The caption stays for screen readers only. |
regionLabel | string | none | The scroll region's name (default: "Table, scrolls sideways"); give the caption's words. |
children required | ReactNode | none |
Tokens#
System tokens (9)
--mk-border--mk-focus--mk-rule-soft--mk-space-2--mk-space-3--mk-space-4--mk-surface--mk-text--mk-z-raised
Its own properties (1)
--mk-table-row
Changelog#
Arrived in 0.1.0.
Sectionwith its plate andArtslot,Plate,VolumeScope,PageHero,SectionHead,Eyebrow,Card,LineCard,InfoPanel,Stack,Cluster,Grid,Container,Main,Ruleand theFittedLineclient fitter;Navbarwith theNavDisclosuremega panels,Footer,FooterMap,BuildStamp,SkipLink,ActionDockandVisitorControls; theTableparts,ComparisonTablewith the one-tier switcher,SpecStrip,Numeral,Stat,StatGroup,StatusChip,BadgeandScoreDial;ProsewithmdxComponents,Quote,CodeBlockwithCopyButton,Figure,ScreenshotFrameandPhoneFrame; and the brand: the three evolved 2 × 2 options inmarkGeometry(a Overprint by default, b Paper seam, c Key block) with the pixel-snappedpxmode and the one-ink seam variant,logoGeometrywith the 1x clear-space frame,Mark,Wordmark,Logo,MaxosMarkandLineBadge. Read the whole entry