lldlab-ui 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,25 +10,82 @@ Design-system components for [LLD Lab](https://lldlab.com), built for React 19 a
10
10
 
11
11
  ---
12
12
 
13
- ## Contents
14
-
15
- - [Install](#install)
16
- - [Setup](#setup)
17
- - [Core concepts](#core-concepts)
18
- - [Components](#components)
19
- - [Layout](#layout): Theme, Box, Stack, Grid, Container, Section, Split
20
- - [Typography](#typography): Text, Heading, Eyebrow, Code, CodeBlock, Markdown
21
- - [Display](#display): Icon, Dot, Badge, Chip, Stat, ProgressBar, SectionHeader, Callout, ResultRow, Message, EmptyState, CheckList, Card
22
- - [Inputs and interaction](#inputs-and-interaction): Button, IconButton, Kbd, TextField, Select, Tabs, SegmentedControl, Dialog, Menu
23
- - [IDE shell](#ide-shell): Workbench, FileTree, EditorTabs, Breadcrumbs, StatusBar, MetricTile, Avatar, Countdown
24
- - [Design tokens](#design-tokens)
25
- - [Accessibility](#accessibility)
26
- - [Troubleshooting](#troubleshooting)
27
- - [Development](#development)
28
- - [Releasing](#releasing)
13
+ ## Table of contents
14
+
15
+ **Quick links:** [What's new in 0.3.0](#whats-new-in-030) · [Install](#install) · [Setup](#setup) · [Component index](#component-index) · [Mobile navigation](#mobile-navigation) · [Design tokens](#design-tokens) · [Troubleshooting](#troubleshooting)
16
+
17
+ 1. [What's new in 0.3.0](#whats-new-in-030)
18
+ 1. [Install](#install)
19
+ 2. [Setup](#setup)
20
+ - [1. Styles](#1-styles) · [2. Fonts](#2-fonts) · [3. Icons](#3-icons) · [4. Use it](#4-use-it)
21
+ 3. [Core concepts](#core-concepts)
22
+ - [No className, no style](#no-classname-no-style) · [Passing through native props](#passing-through-native-props) · [as: render a different element or component](#as-render-a-different-element-or-component) · [Responsive props](#responsive-props) · [Shared value types](#shared-value-types) · [Light and dark scopes](#light-and-dark-scopes)
23
+ 4. [Components](#components)
24
+ - [Component index](#component-index)
25
+ - **[Layout](#layout):** [`Theme`](#theme) · [`Box`](#box) · [`Stack`](#stack) · [`Grid`](#grid) · [`Container`](#container) · [`Section`](#section) · [`Split`](#split) · [`AppBar`](#appbar) · [`Show`](#show) · [`Divider`](#divider)
26
+ - **[Typography](#typography):** [`Text`](#text) · [`Heading`](#heading) · [`Eyebrow`](#eyebrow) · [`Code`](#code) · [`CodeBlock`](#codeblock) · [`TextLink`](#textlink) · [`Markdown`](#markdown)
27
+ - **[Display](#display):** [`Icon`](#icon) · [`Dot`](#dot) · [`Badge`](#badge) · [`Chip`](#chip) · [`Stat`](#stat) · [`ProgressBar`](#progressbar) · [`SectionHeader`](#sectionheader) · [`Callout`](#callout) · [`ResultRow`](#resultrow) · [`Message`](#message) · [`EmptyState`](#emptystate) · [`CheckList`](#checklist) · [`Card`](#card) · [`IconTile`](#icontile) · [`Skeleton`](#skeleton) · [`Table`](#table) · [`DescriptionList`](#descriptionlist) · [`Timeline`](#timeline) · [`BarChart`](#barchart) · [`VerdictBanner`](#verdictbanner) · [`TerminalOutput`](#terminaloutput) · [`DiffViewer`](#diffviewer) · [`Overlay`](#overlay)
28
+ - **[Inputs and interaction](#inputs-and-interaction):** [`Button`](#button) · [`IconButton`](#iconbutton) · [`Kbd`](#kbd) · [`TextField`](#textfield) · [`Select`](#select) · [`Tabs`](#tabs) · [`SegmentedControl`](#segmentedcontrol) · [`Dialog`](#dialog) · [`Menu`](#menu) · [`Checkbox`](#checkbox) · [`Switch`](#switch) · [`Disclosure`](#disclosure) · [`CopyButton`](#copybutton) · [`Tooltip`](#tooltip)
29
+ - **[Navigation and overlays](#navigation-and-overlays):** [`NavList`](#navlist) · [`Pagination`](#pagination) · [`Drawer`](#drawer) · [`CommandPalette`](#commandpalette) · [`Toaster`](#toaster)
30
+ - **[IDE shell](#ide-shell):** [`Workbench`](#workbench) · [`FileTree`](#filetree) · [`EditorTabs`](#editortabs) · [`Breadcrumbs`](#breadcrumbs) · [`StatusBar`](#statusbar) · [`MetricTile`](#metrictile) · [`Avatar`](#avatar) · [`AvatarGroup`](#avatargroup) · [`Countdown`](#countdown) · [`UmlClass`](#umlclass) · [`UmlDiagram`](#umldiagram)
31
+ 5. [Mobile navigation](#mobile-navigation)
32
+ 6. [Design tokens](#design-tokens)
33
+ 7. [Accessibility](#accessibility)
34
+ 8. [Troubleshooting](#troubleshooting)
35
+ 9. [Development](#development)
36
+ 10. [Releasing](#releasing)
37
+ 11. [License](#license)
29
38
 
30
39
  ---
31
40
 
41
+ ## What's new in 0.3.0
42
+
43
+ A fidelity pass against the Stitch mockups. **Visual defaults changed**; the API only grew.
44
+
45
+ **Changed defaults**
46
+
47
+ - Surfaces separate by shadow, not borders: `Card` is `shadow-sm` with no border (add `outlined` for the hairline); `Card.Header` / `Card.Footer` are tinted bars with no rule (add `divider`).
48
+ - `AppBar` floats on a soft shadow (`divider="border"` restores the hairline).
49
+ - Tokens: `rounded` is 2px; `shadow-sm/md/lg/xl` use the lighter Tailwind v3 scale; `fg-brand` is `#2563EB`.
50
+ - `MetricTile`, boxed `ResultRow` and `Badge uppercase` drop their border / extra tracking; `Eyebrow` text takes its tone colour.
51
+ - Nav `Tabs` keep one font weight so the active item never shifts its neighbours.
52
+
53
+ **New props**
54
+
55
+ | Component | Added |
56
+ |---|---|
57
+ | `Card` | `shadow` (none/sm/md/xl), `outlined`, `gap`; `Card.Header`/`Footer`: `divider`, `density` (md/sm), `tone` (default/slate/none) |
58
+ | `AppBar` | `divider` (shadow/border) |
59
+ | `Section` | `paddingTop`, `paddingBottom` (spacing scale), `padding="none"`, `pattern="dots-brand"` |
60
+ | `Split` | `ratio` `7/5`, `5/7`; `breakpoint` (lg/xl); `asideAs` (aside/div) |
61
+ | `GridItem` | new: `span` (responsive column span) |
62
+ | `Show` | `above` / `below` `2xl` |
63
+ | `Heading` | `balance`, `leading="none"` |
64
+ | `Text` | `underline="wavy"` |
65
+ | `Eyebrow` | `variant` `tinted`, `dot` |
66
+ | `Tabs` | `variant` `nav` / `solid` / `label`; item `icon`, `countTone`, `disabled`, `title`, `hideBelow` |
67
+ | `SegmentedControl` | `variant="label"` (compact mono, for toolbars) |
68
+ | `Button` | `size` `xs` / `ms`; `variant` `raised` / `slate` |
69
+ | `IconButton` | `size="ms"` (36px) |
70
+ | `Badge` | `shape="pill"`, `outlined`, `size="xs"`, tones `subtle` / `container` |
71
+ | `TextField` | `variant` (outline/filled/raised), `size` `ms` / `lg`, `width` (auto/full/sm/md/lg), `iconPosition` |
72
+ | `Select` | `variant="raised"`, `size="lg"` |
73
+ | `Kbd` | `variant="raised"` |
74
+ | `Stat` | `variant="tile"`, `iconTone` |
75
+ | `MetricTile` | `variant="centered"` |
76
+ | `Box` | `tone="container"` |
77
+ | `Dot` / `Icon` | `size="lg"` (12px) / `size` `xs` (14px), `ms` (18px) |
78
+ | `Avatar` | `size` `ms` (32px), `ml` (40px) |
79
+ | `SectionHeader` | `divider`, `metaUppercase` |
80
+ | `EmptyState` | `headingLevel` (1–3) |
81
+ | `Checkbox` | `size="sm"` |
82
+ | `CodeBlock` | `bare`; dark blocks are now a dark theme scope |
83
+ | `Countdown` | `variant="chip"` |
84
+ | `StatusBar` | `tone="raised"` |
85
+ | `UmlClass` | `variant="tinted"`, `headerTone`, `columns` |
86
+
87
+ <sub>[↑ Back to top](#table-of-contents)</sub>
88
+
32
89
  ## Install
33
90
 
34
91
  ```bash
@@ -42,6 +99,10 @@ npm install lldlab-ui
42
99
 
43
100
  The package is ESM-only and ships TypeScript types.
44
101
 
102
+ Runtime dependencies (installed automatically): `react-markdown` and `remark-gfm` (for `Markdown`), `prism-react-renderer` (for `CodeBlock highlight`), and `@dagrejs/dagre` (for `UmlDiagram`). dagre is loaded with a dynamic `import()` only when a `UmlDiagram` renders, so apps that never show a diagram never download it.
103
+
104
+ <sub>[↑ Back to top](#table-of-contents)</sub>
105
+
45
106
  ## Setup
46
107
 
47
108
  ### 1. Styles
@@ -134,6 +195,8 @@ The bundle starts with `'use client'`, so any component can be imported from a N
134
195
 
135
196
  ---
136
197
 
198
+ <sub>[↑ Back to top](#table-of-contents)</sub>
199
+
137
200
  ## Core concepts
138
201
 
139
202
  ### No `className`, no `style`
@@ -200,7 +263,7 @@ These types are exported from the package.
200
263
  | `StatusTone` (dots, eyebrows, section headers) | `neutral` · `brand` · `success` · `warning` · `danger` |
201
264
  | `SurfaceTone` (backgrounds) | `surface` · `subtle` · `elevated` · `low` · `inverse` |
202
265
  | `BadgeTone` | `neutral` · `brand` · `success` · `warning` · `danger` · `info` |
203
- | `ButtonVariant` | `primary` · `secondary` · `subtle` · `ghost` · `danger` |
266
+ | `ButtonVariant` | `primary` · `secondary` · `subtle` · `ghost` · `danger` · `brand` (cobalt) · `accent` (crimson call to action, not destructive) |
204
267
 
205
268
  ### Light and dark scopes
206
269
 
@@ -215,10 +278,89 @@ Components use semantic tokens only, so every component works in both scopes. A
215
278
 
216
279
  ---
217
280
 
281
+ <sub>[↑ Back to top](#table-of-contents)</sub>
282
+
218
283
  ## Components
219
284
 
220
285
  In the tables, **Req.** marks required props, and the default is given where one exists. Every component also forwards the native props of its root element, except `className` and `style`.
221
286
 
287
+ ### Component index
288
+
289
+ | Component | Group | Use it for |
290
+ |---|---|---|
291
+ | [`Theme`](#theme) | Layout | Scope light/dark tokens for a subtree |
292
+ | [`Box`](#box) | Layout | Generic surface: padding, tone, radius, border |
293
+ | [`Stack`](#stack) | Layout | Flex row/column with gaps |
294
+ | [`Grid`](#grid) | Layout | Responsive CSS grid |
295
+ | [`Container`](#container) | Layout | Centred page column with fluid gutters |
296
+ | [`Section`](#section) | Layout | Full-width page band |
297
+ | [`Split`](#split) | Layout | Main content + aside (+ optional start rail) |
298
+ | [`AppBar`](#appbar) | Layout | Sticky site/app header |
299
+ | [`Show`](#show) | Layout | Show only above/below a breakpoint |
300
+ | [`Divider`](#divider) | Layout | Horizontal/vertical rule, "or" divider |
301
+ | [`Text`](#text) | Typography | Body, label and code text |
302
+ | [`Heading`](#heading) | Typography | h1–h4 with fluid sizes |
303
+ | [`Eyebrow`](#eyebrow) | Typography | Pill label above a heading |
304
+ | [`Code`](#code) | Typography | Inline code |
305
+ | [`CodeBlock`](#codeblock) | Typography | Code block with highlighting |
306
+ | [`TextLink`](#textlink) | Typography | Inline text link |
307
+ | [`Markdown`](#markdown) | Typography | Safe markdown rendering |
308
+ | [`Icon`](#icon) | Display | Material Symbols icon |
309
+ | [`Dot`](#dot) | Display | Status dot |
310
+ | [`Badge`](#badge) | Display | Small status/label pill |
311
+ | [`Chip`](#chip) | Display | Removable tag |
312
+ | [`Stat`](#stat) | Display | Icon + label + value |
313
+ | [`ProgressBar`](#progressbar) | Display | Labelled progress |
314
+ | [`SectionHeader`](#sectionheader) | Display | Header row for a group |
315
+ | [`Callout`](#callout) | Display | Tinted notice box |
316
+ | [`ResultRow`](#resultrow) | Display | Test result / review row |
317
+ | [`Message`](#message) | Display | Loading/empty/error line |
318
+ | [`EmptyState`](#emptystate) | Display | Empty, 404 and error blocks |
319
+ | [`CheckList`](#checklist) | Display | List with check (or cross) icons |
320
+ | [`Card`](#card) | Display | Card with header/media/footer slots |
321
+ | [`IconTile`](#icontile) | Display | Icon in a tinted tile |
322
+ | [`Skeleton`](#skeleton) | Display | Loading placeholder |
323
+ | [`Table`](#table) | Display | Semantic, scrollable table |
324
+ | [`DescriptionList`](#descriptionlist) | Display | Term / detail pairs |
325
+ | [`Timeline`](#timeline) | Display | Steps and events with status |
326
+ | [`BarChart`](#barchart) | Display | Small accessible bar chart |
327
+ | [`VerdictBanner`](#verdictbanner) | Display | Result hero ("Accepted") |
328
+ | [`TerminalOutput`](#terminaloutput) | Display | Toned log output |
329
+ | [`DiffViewer`](#diffviewer) | Display | Unified/split line diff |
330
+ | [`Overlay`](#overlay) | Display | Blur and lock content (gates) |
331
+ | [`Button`](#button) | Inputs and interaction | Buttons and link buttons |
332
+ | [`IconButton`](#iconbutton) | Inputs and interaction | Icon-only button or link |
333
+ | [`Kbd`](#kbd) | Inputs and interaction | Keyboard hint |
334
+ | [`TextField`](#textfield) | Inputs and interaction | Labelled text input |
335
+ | [`Select`](#select) | Inputs and interaction | Native select |
336
+ | [`Tabs`](#tabs) | Inputs and interaction | Tablist or nav tabs |
337
+ | [`SegmentedControl`](#segmentedcontrol) | Inputs and interaction | Single-choice pills |
338
+ | [`Dialog`](#dialog) | Inputs and interaction | Modal dialog |
339
+ | [`Menu`](#menu) | Inputs and interaction | Menu button |
340
+ | [`Checkbox`](#checkbox) | Inputs and interaction | Labelled checkbox |
341
+ | [`Switch`](#switch) | Inputs and interaction | On/off switch |
342
+ | [`Disclosure`](#disclosure) | Inputs and interaction | Expandable region |
343
+ | [`CopyButton`](#copybutton) | Inputs and interaction | Copy text to clipboard |
344
+ | [`Tooltip`](#tooltip) | Inputs and interaction | Short hover/focus hint |
345
+ | [`NavList`](#navlist) | Navigation and overlays | Sidebar / table of contents |
346
+ | [`Pagination`](#pagination) | Navigation and overlays | Page navigation |
347
+ | [`Drawer`](#drawer) | Navigation and overlays | Slide-over panel (mobile nav) |
348
+ | [`CommandPalette`](#commandpalette) | Navigation and overlays | ⌘K search palette |
349
+ | [`Toaster`](#toaster) | Navigation and overlays | Toast notifications (useToast) |
350
+ | [`Workbench`](#workbench) | IDE shell | Resizable IDE layout |
351
+ | [`FileTree`](#filetree) | IDE shell | Keyboard file tree |
352
+ | [`EditorTabs`](#editortabs) | IDE shell | Open-file tabs |
353
+ | [`Breadcrumbs`](#breadcrumbs) | IDE shell | Breadcrumb trail |
354
+ | [`StatusBar`](#statusbar) | IDE shell | IDE status bar |
355
+ | [`MetricTile`](#metrictile) | IDE shell | Label + big value |
356
+ | [`Avatar`](#avatar) | IDE shell | User avatar |
357
+ | [`AvatarGroup`](#avatargroup) | IDE shell | Overlapping avatars |
358
+ | [`Countdown`](#countdown) | IDE shell | Countdown / elapsed timer |
359
+ | [`UmlClass`](#umlclass) | IDE shell | UML class box |
360
+ | [`UmlDiagram`](#umldiagram) | IDE shell | Auto-laid-out class diagram |
361
+
362
+ <sub>[↑ Back to top](#table-of-contents)</sub>
363
+
222
364
  ### Layout
223
365
 
224
366
  #### `Theme`
@@ -245,6 +387,9 @@ A generic surface. Polymorphic, default `div`.
245
387
  | `radius` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` |
246
388
  | `border` | `'none' \| 'subtle' \| 'strong'` | `'none'` |
247
389
  | `shadow` | `'none' \| 'sm' \| 'md'` | `'none'` |
390
+ | `dimmed` | `boolean`: greys the content out and makes it `inert` (for example, a panel waiting on a runtime) | `false` |
391
+
392
+ `tone="inverse"` also switches its contents to the dark tokens (`data-theme="dark"`), so text and badges inside stay readable.
248
393
 
249
394
  ```tsx
250
395
  <Box tone="elevated" border="subtle" radius="lg" padding={{ base: 'md', lg: 'lg' }}>…</Box>
@@ -300,6 +445,8 @@ A full-width page band with fluid vertical padding. Polymorphic, default `sectio
300
445
  | `padding` | `'md' \| 'lg' \| 'xl'`: fluid, about 2–4rem, 3–6rem and 4–8rem | `'lg'` |
301
446
  | `pattern` | `'none' \| 'dots' \| 'grid'` | `'none'` |
302
447
 
448
+ `tone="inverse"` scopes the dark tokens for its contents, like `Box`.
449
+
303
450
  ```tsx
304
451
  <Section tone="subtle" pattern="dots" padding="xl">
305
452
  <Container>…</Container>
@@ -315,7 +462,9 @@ Main content plus an aside, side by side from `xl` and stacked below it.
315
462
  | `aside` **Req.** | `ReactNode` | none |
316
463
  | `children` **Req.** | `ReactNode` (main content) | none |
317
464
  | `ratio` | `'8/4' \| '1/1' \| '9/3'` (out of 12 columns) | `'8/4'` |
318
- | `sticky` | `boolean`: the aside sticks while scrolling (xl+) | `false` |
465
+ | `sticky` | `boolean`: the aside (and `start`) stick while scrolling | `false` |
466
+ | `stickyOffset` | `'none' \| 'appbar'`: `appbar` sticks below a 64px `AppBar` | `'none'` |
467
+ | `start` | `ReactNode`: a leading rail (e.g. a table of contents), shown from `lg`. With it the layout is 3 / 9 columns from `lg` and 2 / 7 / 3 from `xl`, and `ratio` is ignored | none |
319
468
  | `gap` | `Responsive<Space>` | `'lg'` |
320
469
 
321
470
  ```tsx
@@ -324,6 +473,55 @@ Main content plus an aside, side by side from `xl` and stacked below it.
324
473
  </Split>
325
474
  ```
326
475
 
476
+ #### `AppBar`
477
+
478
+ A site or app header bar with `start`, `center` and `end` slots.
479
+
480
+ | Prop | Type | Default |
481
+ |---|---|---|
482
+ | `start` | `ReactNode` (logo) | none |
483
+ | `center` | `ReactNode` (navigation, search) | none |
484
+ | `end` | `ReactNode` (actions, account) | none |
485
+ | `position` | `'sticky' \| 'fixed' \| 'static'` | `'sticky'` |
486
+ | `height` | `'sm' \| 'md'` (48px / 64px) | `'md'` |
487
+ | `blur` | `boolean`: translucent background with backdrop blur | `true` |
488
+ | `contained` | `boolean`: constrain the content to the 80rem page column | `true` |
489
+
490
+ ```tsx
491
+ <AppBar start={<Logo />} center={<Tabs label="Site" value="problems" items={navTabs} />} end={<IconButton icon="notifications" label="Notifications" />} />
492
+ ```
493
+
494
+ #### `Show`
495
+
496
+ Renders its children only above or only below a breakpoint. It uses `display: contents`, so it adds no box to the layout. Pass exactly one of `above` or `below`.
497
+
498
+ | Prop | Type |
499
+ |---|---|
500
+ | `above` | `'sm' \| 'md' \| 'lg' \| 'xl'`: render from this breakpoint up |
501
+ | `below` | `'sm' \| 'md' \| 'lg' \| 'xl'`: render only below this breakpoint |
502
+ | `children` **Req.** | `ReactNode` |
503
+
504
+ ```tsx
505
+ <Show above="lg"><Tabs … /></Show>
506
+ <Show below="lg"><IconButton icon="menu" label="Open menu" onClick={openDrawer} /></Show>
507
+ ```
508
+
509
+ #### `Divider`
510
+
511
+ A horizontal or vertical rule, optionally with a centred label (the "or" divider).
512
+
513
+ | Prop | Type | Default |
514
+ |---|---|---|
515
+ | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` |
516
+ | `label` | `ReactNode` (horizontal only) | none |
517
+ | `spacing` | `Space`: margin on both sides of the rule | `'none'` |
518
+
519
+ ```tsx
520
+ <Divider label="or" spacing="md" />
521
+ ```
522
+
523
+ <sub>[↑ Back to top](#table-of-contents)</sub>
524
+
327
525
  ### Typography
328
526
 
329
527
  #### `Text`
@@ -332,11 +530,14 @@ Body text. Polymorphic, default `p`.
332
530
 
333
531
  | Prop | Type | Default |
334
532
  |---|---|---|
335
- | `variant` | `'body-lead' \| 'body-md' \| 'body-sm' \| 'label' \| 'code'` | `'body-md'` |
533
+ | `variant` | `'body-lead' \| 'body-md' \| 'body-sm' \| 'label' \| 'code' \| 'inherit'` (`inherit` keeps the parent's font and size, e.g. a highlighted word inside a `Heading`) | `'body-md'` |
336
534
  | `tone` | `Tone` | `'default'` |
337
535
  | `weight` | `'regular' \| 'medium' \| 'semibold'` | `'regular'` |
338
536
  | `truncate` | `boolean`: a single line with an ellipsis | `false` |
339
537
  | `clamp` | `1 \| 2 \| 3 \| 4`: the number of lines before an ellipsis | none |
538
+ | `align` | `'start' \| 'center' \| 'end'` | none |
539
+ | `measure` | `boolean`: limit the line length to a readable width | `false` |
540
+ | `uppercase` | `boolean` | `true` for `label`, `false` otherwise |
340
541
 
341
542
  `label` is JetBrains Mono in uppercase. Long words wrap instead of overflowing.
342
543
 
@@ -350,7 +551,9 @@ Body text. Polymorphic, default `p`.
350
551
  |---|---|---|
351
552
  | `level` **Req.** | `1 \| 2 \| 3 \| 4`: which element (`h1`–`h4`) | none |
352
553
  | `size` | `Responsive<HeadingSize>` | from the level: 1→`xl`, 2→`lg`, 3→`md`, 4→`sm` |
353
- | `tone` | `'default' \| 'muted' \| 'brand' \| 'inverse'` | `'default'` |
554
+ | `tone` | `'default' \| 'muted' \| 'brand' \| 'inverse' \| 'success' \| 'danger' \| 'warning'` | `'default'` |
555
+ | `truncate` | `boolean`: a single line with an ellipsis | `false` |
556
+ | `align` | `'start' \| 'center'` | `'start'` |
354
557
 
355
558
  `display`, `xl` and `lg` scale fluidly with the viewport. `level` sets the document outline and `size` sets the look, so they are independent.
356
559
 
@@ -366,6 +569,8 @@ A small uppercase pill with a status dot, used above hero headings.
366
569
  |---|---|---|
367
570
  | `children` **Req.** | `ReactNode` | none |
368
571
  | `tone` | `StatusTone` (the dot colour) | `'brand'` |
572
+ | `pulse` | `boolean`: pulsing dot | `false` |
573
+ | `variant` | `'pill' \| 'plain'` (`plain` has no border or background) | `'pill'` |
369
574
 
370
575
  #### `Code`
371
576
 
@@ -373,12 +578,38 @@ Inline code. Props: `children`.
373
578
 
374
579
  #### `CodeBlock`
375
580
 
376
- A dark code block. It scrolls horizontally inside itself, so long lines never widen the page. It is keyboard-focusable so the scroll area can be reached.
581
+ A code block. It scrolls horizontally inside itself, so long lines never widen the page, and it is keyboard-focusable so the scroll area can be reached.
582
+
583
+ | Prop | Type | Default |
584
+ |---|---|---|
585
+ | `children` **Req.** | `ReactNode` (the code; a `string` for `highlight` and `lineNumbers`) | none |
586
+ | `language` | `string`: the language, shown as the caption when there's no `title` | none |
587
+ | `highlight` | `boolean`: syntax highlighting for `ts`, `tsx`, `js`, `jsx`, `python`, `go`, `java`, `json` and `bash`. Unknown languages and non-string children fall back to plain text | `false` |
588
+ | `title` | `ReactNode`: header text, such as a file name | none |
589
+ | `meta` | `ReactNode`: next to the title, such as a `Badge` | none |
590
+ | `actions` | `ReactNode`: right side of the header, such as a `CopyButton` | none |
591
+ | `lineNumbers` | `boolean` | `false` |
592
+ | `tone` | `'dark' \| 'subtle'` (`subtle` is a light surface in the light theme) | `'dark'` |
593
+
594
+ ```tsx
595
+ <CodeBlock language="go" highlight lineNumbers title="lot.go" actions={<CopyButton value={code} />}>{code}</CodeBlock>
596
+ ```
597
+
598
+ #### `TextLink`
599
+
600
+ An inline text link. Polymorphic, default `a`.
377
601
 
378
602
  | Prop | Type | Default |
379
603
  |---|---|---|
380
- | `children` **Req.** | `ReactNode` (the code) | none |
381
- | `language` | `string`: shown as a caption, with no highlighting | none |
604
+ | `children` **Req.** | `ReactNode` | none |
605
+ | `tone` | `'brand' \| 'default' \| 'muted' \| 'danger' \| 'success' \| 'warning'` | `'brand'` |
606
+ | `size` | `'sm' \| 'md'` | `'md'` |
607
+ | `icon` / `iconRight` | `string` | none |
608
+ | `underline` | `'hover' \| 'always' \| 'none'` | `'hover'` |
609
+
610
+ ```tsx
611
+ <TextLink as={Link} href="/patterns" iconRight="arrow_forward">View all patterns</TextLink>
612
+ ```
382
613
 
383
614
  #### `Markdown`
384
615
 
@@ -394,6 +625,8 @@ Raw HTML in the source is **not** rendered, and `javascript:` links are stripped
394
625
  <Markdown>{problem.statement}</Markdown>
395
626
  ```
396
627
 
628
+ <sub>[↑ Back to top](#table-of-contents)</sub>
629
+
397
630
  ### Display
398
631
 
399
632
  #### `Icon`
@@ -427,6 +660,9 @@ A small coloured status dot, always decorative.
427
660
  | `tone` | `BadgeTone` | `'neutral'` |
428
661
  | `size` | `'sm' \| 'md'` | `'sm'` |
429
662
  | `uppercase` | `boolean` | `false` |
663
+ | `icon` | `string`: a leading icon | none |
664
+ | `dot` | `StatusTone`: a leading status dot | none |
665
+ | `pulse` | `boolean`: pulses the dot | `false` |
430
666
 
431
667
  ```tsx
432
668
  <Badge tone="success" uppercase>Beginner</Badge>
@@ -439,8 +675,9 @@ An outlined tag, such as a pattern category. It can be removable.
439
675
  | Prop | Type | Default |
440
676
  |---|---|---|
441
677
  | `children` **Req.** | `string` | none |
442
- | `tone` | `'neutral' \| 'brand'` | `'neutral'` |
678
+ | `tone` | `'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` |
443
679
  | `icon` | `string` | none |
680
+ | `dot` | `StatusTone` or any CSS colour (e.g. a language's brand colour `"#00ADD8"`) | none |
444
681
  | `onRemove` | `() => void`: shows a remove button named "Remove {children}" | none |
445
682
 
446
683
  #### `Stat`
@@ -457,11 +694,14 @@ An icon with a small label above a large value.
457
694
 
458
695
  | Prop | Type | Default |
459
696
  |---|---|---|
460
- | `label` **Req.** | `string`: the visible label, which also names the bar | none |
697
+ | `label` **Req.** | `ReactNode`: the visible label, which also names the bar | none |
461
698
  | `value` **Req.** | `number` | none |
462
699
  | `max` | `number` | `100` |
463
700
  | `tone` | `'brand' \| 'success' \| 'warning' \| 'danger'` | `'brand'` |
464
701
  | `hideLabel` | `boolean`: keeps the label for screen readers only | `false` |
702
+ | `valueLabel` | `ReactNode`: replaces the percentage, e.g. "7 of 12" | the percentage |
703
+ | `caption` | `ReactNode`: a line below the bar | none |
704
+ | `size` | `'sm' \| 'md'` (4px / 6px bar) | `'md'` |
465
705
 
466
706
  `value` is clamped to `0…max`. A `max` of 0 or less shows 0%.
467
707
 
@@ -471,19 +711,24 @@ An icon with a small label above a large value.
471
711
 
472
712
  #### `SectionHeader`
473
713
 
474
- A header row for a group of items: dot, heading, tag and a right-aligned meta line.
714
+ A header row for a group of items: icon, dot, heading, tag, a right-aligned meta line and an optional description.
475
715
 
476
716
  | Prop | Type | Default |
477
717
  |---|---|---|
478
718
  | `title` **Req.** | `ReactNode` | none |
479
719
  | `level` | `2 \| 3` | `2` |
720
+ | `size` | `'sm' \| 'md'` (the heading size) | `'sm'` |
480
721
  | `dot` | `StatusTone` | none |
722
+ | `icon` | `string`: shown in an `IconTile` | none |
481
723
  | `tag` | `ReactNode`: shown as an uppercase badge | none |
724
+ | `tagTone` | `BadgeTone` | `'neutral'` |
482
725
  | `meta` | `ReactNode` | none |
726
+ | `description` | `ReactNode`: a full-width line below | none |
727
+ | `accent` | `StatusTone`: a 2px coloured underline instead of the hairline | none |
483
728
 
484
729
  #### `Callout`
485
730
 
486
- A tinted notice box. `danger` is announced as an alert, and the other tones as a status.
731
+ A tinted notice box. By default `danger` is announced as an alert, and the other tones as a status. Set `live={false}` for static content such as pros and cons.
487
732
 
488
733
  | Prop | Type | Default |
489
734
  |---|---|---|
@@ -491,17 +736,25 @@ A tinted notice box. `danger` is announced as an alert, and the other tones as a
491
736
  | `tone` | `'info' \| 'success' \| 'warning' \| 'danger'` | `'info'` |
492
737
  | `title` | `ReactNode` | none |
493
738
  | `action` | `ReactNode`, such as a `Button` | none |
739
+ | `live` | `boolean`: announce as alert/status | `true` |
740
+ | `icon` | `string`: overrides the tone's icon | tone icon |
741
+ | `size` | `'sm' \| 'md'` (`sm` suits inline form errors) | `'md'` |
742
+ | `accent` | `boolean`: a thick left border | `false` |
494
743
 
495
744
  #### `ResultRow`
496
745
 
497
- One test result or submission row. The status icon carries an accessible name: "Passed", "Failed" or "Pending".
746
+ One test result, review item or submission row. The status icon carries an accessible name: "Passed", "Failed", "Warning" or "Pending".
498
747
 
499
- | Prop | Type |
500
- |---|---|
501
- | `status` **Req.** | `'pass' \| 'fail' \| 'pending'` |
502
- | `title` **Req.** | `ReactNode` |
503
- | `detail` | `ReactNode`: monospace, keeps line breaks |
504
- | `meta` | `ReactNode`, such as a duration |
748
+ | Prop | Type | Default |
749
+ |---|---|---|
750
+ | `status` **Req.** | `'pass' \| 'fail' \| 'warning' \| 'pending'` | none |
751
+ | `title` **Req.** | `ReactNode` | none |
752
+ | `detail` | `ReactNode`: monospace, keeps line breaks | none |
753
+ | `meta` | `ReactNode`, such as a duration | none |
754
+ | `badge` | `ReactNode`: trailing, such as a category `Badge` | none |
755
+ | `variant` | `'plain' \| 'boxed'` | `'plain'` |
756
+ | `selected` | `boolean`: a cobalt left accent | `false` |
757
+ | `titleMono` | `boolean`: monospace title (test names) | `false` |
505
758
 
506
759
  #### `Message`
507
760
 
@@ -520,12 +773,17 @@ A one-line loading, empty or error message. `danger` is announced as an alert, a
520
773
  | `icon` | `string` | `'inbox'` |
521
774
  | `description` | `ReactNode` | none |
522
775
  | `action` | `ReactNode` | none |
776
+ | `media` | `ReactNode`: an illustration that replaces the icon | none |
777
+ | `code` | `string`: a large mono numeral such as `"404"`, replacing the icon | none |
778
+ | `tone` | `'default' \| 'danger'` | `'default'` |
523
779
 
524
780
  #### `CheckList`
525
781
 
526
782
  | Prop | Type |
527
783
  |---|---|
528
- | `items` **Req.** | `ReactNode[]`, each rendered with a check icon |
784
+ | `items` **Req.** | `ReactNode[]`, each rendered with the icon |
785
+ | `icon` | `string` (default `'check'`; use `'close'` for a cons list) |
786
+ | `tone` | `Tone` (default `'success'`) |
529
787
 
530
788
  #### `Card`
531
789
 
@@ -534,17 +792,21 @@ A bordered, rounded surface. Polymorphic, default `div`.
534
792
  | Prop | Type | Default |
535
793
  |---|---|---|
536
794
  | `padding` | `Responsive<Space>`: the body padding | `'lg'` |
537
- | `tone` | `'default' \| 'inverse'` (dark obsidian card) | `'default'` |
795
+ | `tone` | `'default' \| 'subtle' \| 'inverse'` (`inverse` is a dark obsidian card that also switches its contents to the dark tokens) | `'default'` |
796
+ | `pattern` | `'none' \| 'dots' \| 'grid'`: background pattern | `'none'` |
538
797
  | `interactive` | `boolean`: hover shadow and focus ring, for link cards | `false` |
539
798
 
540
799
  Sub-components:
541
800
 
542
- - **`Card.Media`** is always rendered first, edge to edge.
801
+ - **`Card.Header`** is always rendered first, as a tinted header bar with `start` and `end` slots (or `children` in place of `start`).
802
+ - **`Card.Media`** comes next, edge to edge.
543
803
 
544
804
  | Prop | Type | Default |
545
805
  |---|---|---|
546
806
  | `pattern` | `'none' \| 'dots' \| 'grid'` | `'dots'` |
547
807
  | `aspect` | `'video' \| 'wide' \| 'square'` | `'video'` |
808
+ | `height` | `'sm' \| 'md'` (120px / 140px), instead of `aspect` | none |
809
+ | `caption` | `ReactNode`: a small corner label, e.g. "UML schema" | none |
548
810
  | `children` | `ReactNode` (centred overlay) | none |
549
811
 
550
812
  - **`Card.Footer`** is always rendered last as a tinted footer bar. It takes only `children`.
@@ -560,6 +822,141 @@ All other children go into the padded body, whatever their order in the JSX.
560
822
  </Card>
561
823
  ```
562
824
 
825
+ #### `IconTile`
826
+
827
+ An icon in a tinted square or circle.
828
+
829
+ | Prop | Type | Default |
830
+ |---|---|---|
831
+ | `icon` **Req.** | `string` | none |
832
+ | `tone` | `'neutral' \| 'brand' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` |
833
+ | `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` (32, 40, 48, 56px) | `'md'` |
834
+ | `shape` | `'square' \| 'circle'` | `'square'` |
835
+ | `filled` | `boolean`: a solid tile with inverted colours | `false` |
836
+ | `label` | `string`: makes it an image with this name (otherwise decorative) | none |
837
+
838
+ #### `Skeleton`
839
+
840
+ A shimmering loading placeholder. It is hidden from assistive tech: pair it with a `Message` that says what is loading. The shimmer stops under `prefers-reduced-motion`.
841
+
842
+ | Prop | Type | Default |
843
+ |---|---|---|
844
+ | `shape` | `'line' \| 'pill' \| 'rect' \| 'circle'` | `'line'` |
845
+ | `width` | `'full' \| '3/4' \| '1/2' \| '1/3' \| '1/4'` (ignored for circles) | `'full'` |
846
+ | `height` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | per shape |
847
+ | `lines` | `number`: render that many text lines, the last one shorter | none |
848
+
849
+ ```tsx
850
+ <Message>Loading problems…</Message>
851
+ <Skeleton lines={3} />
852
+ ```
853
+
854
+ #### `Table`
855
+
856
+ A semantic table inside a focusable horizontal scroller, so wide tables never widen the page.
857
+
858
+ | Prop | Type | Default |
859
+ |---|---|---|
860
+ | `caption` **Req.** | `string`: names the table and its scroll region | none |
861
+ | `columns` **Req.** | `{ key: string; header: ReactNode; align?: 'start' \| 'end'; mono?: boolean; width?: 'auto' \| 'min' }[]` | none |
862
+ | `rows` **Req.** | `Record<string, ReactNode>[]` (keyed by column `key`) | none |
863
+ | `rowKey` | `(row, index) => string` | the index |
864
+ | `showCaption` | `boolean`: show the caption visually (it is always read by screen readers) | `false` |
865
+ | `density` | `'compact' \| 'normal'` | `'normal'` |
866
+ | `empty` | `ReactNode`: shown when `rows` is empty | `'No rows'` |
867
+
868
+ ```tsx
869
+ <Table caption="Participants" columns={[{ key: 'name', header: 'Participant', mono: true }, { key: 'role', header: 'Responsibility' }]} rows={participants} />
870
+ ```
871
+
872
+ #### `DescriptionList`
873
+
874
+ Term and detail pairs (`<dl>`).
875
+
876
+ | Prop | Type | Default |
877
+ |---|---|---|
878
+ | `items` **Req.** | `{ term: ReactNode; detail: ReactNode }[]` | none |
879
+ | `layout` | `'stacked' \| 'inline'` (`inline` puts term and detail side by side from `sm`) | `'stacked'` |
880
+ | `mono` | `boolean`: monospace details | `false` |
881
+
882
+ #### `Timeline`
883
+
884
+ A vertical list of steps or events with status markers. Each status is also spoken ("Completed:", "Locked:"…), so colour is never the only signal. The `current` item gets `aria-current="step"`.
885
+
886
+ | Prop | Type |
887
+ |---|---|
888
+ | `label` **Req.** | `string` |
889
+ | `items` **Req.** | `{ id: string; status: 'done' \| 'current' \| 'locked' \| 'success' \| 'warning' \| 'danger' \| 'pending'; title: ReactNode; badge?: ReactNode; description?: ReactNode; meta?: ReactNode }[]` |
890
+
891
+ ```tsx
892
+ <Timeline label="Learning track" items={[{ id: '1', status: 'done', title: 'Parking lot' }, { id: '2', status: 'current', title: 'Elevator' }]} />
893
+ ```
894
+
895
+ #### `BarChart`
896
+
897
+ A small CSS bar chart. The chart is an image with a summary as its name, and the values are also in a visually hidden table.
898
+
899
+ | Prop | Type | Default |
900
+ |---|---|---|
901
+ | `label` **Req.** | `string` | none |
902
+ | `bars` **Req.** | `{ value: number; label?: string }[]` | none |
903
+ | `highlight` | `number`: index of the bar to emphasise (others are greyed) | none |
904
+ | `highlightLabel` | `string`: shown above the highlighted bar | none |
905
+ | `axis` | `[ReactNode, ReactNode, ReactNode]`: start, middle and end labels | none |
906
+ | `height` | `'sm' \| 'md'` | `'md'` |
907
+ | `tone` | `'brand' \| 'success'` | `'brand'` |
908
+
909
+ #### `VerdictBanner`
910
+
911
+ A result hero, such as "Accepted". It stacks below `md` and becomes a row from `md`.
912
+
913
+ | Prop | Type |
914
+ |---|---|
915
+ | `tone` **Req.** | `'success' \| 'danger' \| 'warning'` |
916
+ | `icon` **Req.** | `string` |
917
+ | `title` **Req.** | `ReactNode` |
918
+ | `badge` | `ReactNode` |
919
+ | `meta` | `ReactNode[]`: short facts separated by dividers |
920
+ | `actions` | `ReactNode` |
921
+
922
+ ```tsx
923
+ <VerdictBanner tone="success" icon="check" title="Accepted" meta={['41ms', '1.4 MB', 'attempt #3']} actions={<Button variant="brand">Next Problem</Button>} />
924
+ ```
925
+
926
+ #### `TerminalOutput`
927
+
928
+ A dark, focusable log (`role="log"`) with toned lines. It scrolls inside itself and wraps long lines.
929
+
930
+ | Prop | Type | Default |
931
+ |---|---|---|
932
+ | `lines` **Req.** | `{ kind: 'command' \| 'plain' \| 'error' \| 'warning' \| 'hint' \| 'success'; text: string }[]` | none |
933
+ | `title` | `ReactNode` | none |
934
+ | `status` | `ReactNode`: right side of the header, e.g. a `Badge` | none |
935
+ | `maxHeight` | `'sm' \| 'md' \| 'lg' \| 'none'` | `'md'` |
936
+
937
+ #### `DiffViewer`
938
+
939
+ A line diff of two strings. Added and removed lines are coloured, carry a +/− sign and are announced as "added:" or "removed:".
940
+
941
+ | Prop | Type | Default |
942
+ |---|---|---|
943
+ | `oldValue` **Req.** | `string` | none |
944
+ | `newValue` **Req.** | `string` | none |
945
+ | `oldTitle` / `newTitle` | `ReactNode` | none |
946
+ | `mode` | `'unified' \| 'split'` (`split` falls back to unified below `lg`) | `'unified'` |
947
+
948
+ #### `Overlay`
949
+
950
+ Covers content with a blurred, dimmed layer, for example a signed-out gate. The covered content is `inert` and hidden from assistive tech.
951
+
952
+ | Prop | Type | Default |
953
+ |---|---|---|
954
+ | `children` **Req.** | `ReactNode` (the covered content) | none |
955
+ | `overlay` **Req.** | `ReactNode` (what shows on top) | none |
956
+ | `blur` | `boolean` | `true` |
957
+
958
+ <sub>[↑ Back to top](#table-of-contents)</sub>
959
+
563
960
  ### Inputs and interaction
564
961
 
565
962
  #### `Button`
@@ -573,6 +970,9 @@ Polymorphic, default `button`.
573
970
  | `size` | `'sm' \| 'md' \| 'lg'` (32, 40, 48px tall) | `'md'` |
574
971
  | `icon` | `string`: an icon before the label | none |
575
972
  | `iconRight` | `string`: an icon after the label | none |
973
+ | `iconTone` | `Tone`: colour of `icon` | none |
974
+ | `iconFilled` | `boolean`: filled `icon` | `false` |
975
+ | `leading` | `ReactNode`: custom leading content, such as a brand logo; replaces `icon` | none |
576
976
  | `fullWidth` | `boolean` | `false` |
577
977
  | `loading` | `boolean`: disables the button, shows a spinner and sets `aria-busy` | `false` |
578
978
  | `disabled` | `boolean` | `false` |
@@ -586,14 +986,16 @@ As a native button it defaults to `type="button"`; pass `type="submit"` for form
586
986
 
587
987
  #### `IconButton`
588
988
 
589
- A square, icon-only button. All `<button>` props are forwarded.
989
+ A square, icon-only button. Polymorphic, default `button`, so it can also be a link (`as={Link} href=…`).
590
990
 
591
991
  | Prop | Type | Default |
592
992
  |---|---|---|
593
993
  | `icon` **Req.** | `string` | none |
594
- | `label` **Req.** | `string`: the accessible name and tooltip | none |
595
- | `variant` | `'ghost' \| 'subtle' \| 'primary'` | `'ghost'` |
596
- | `size` | `'sm' \| 'md'` (32, 40px) | `'md'` |
994
+ | `label` **Req.** | `string`: the accessible name and tooltip. Include what `dot`/`badge` mean, e.g. "Notifications, 3 unread" | none |
995
+ | `variant` | `'ghost' \| 'subtle' \| 'secondary' \| 'primary'` | `'ghost'` |
996
+ | `size` | `'xs' \| 'sm' \| 'md'` (24, 32, 40px; at least 44px below `md`) | `'md'` |
997
+ | `dot` | `StatusTone`: a small corner dot | none |
998
+ | `badge` | `ReactNode`: a corner count | none |
597
999
 
598
1000
  #### `Kbd`
599
1001
 
@@ -610,6 +1012,9 @@ A labelled text input. All `<input>` props are forwarded, so it works controlled
610
1012
  | `icon` | `string`: a leading icon | none |
611
1013
  | `hint` | `ReactNode`: trailing content, such as `<Kbd>⌘K</Kbd>` | none |
612
1014
  | `error` | `string`: sets `aria-invalid` and links the message as the description | none |
1015
+ | `labelEnd` | `ReactNode`: at the end of the label row, e.g. a "Forgot password?" `TextLink` | none |
1016
+ | `revealable` | `boolean`: a password field with a show/hide toggle | `false` |
1017
+ | `size` | `'sm' \| 'md'` (32px / 40px) | `'md'` |
613
1018
 
614
1019
  ```tsx
615
1020
  <TextField label="Search problems" hideLabel icon="search" hint={<Kbd>⌘K</Kbd>} value={q} onChange={(e) => setQ(e.target.value)} />
@@ -637,11 +1042,13 @@ A tab strip that scrolls horizontally when it doesn't fit.
637
1042
  | `onChange` | `(id: string) => void` | none |
638
1043
  | `variant` | `'underline' \| 'pills'` | `'underline'` |
639
1044
 
640
- `TabItem`: `{ id: string; label: ReactNode; count?: number; dot?: StatusTone; href?: string; as?: ElementType }`
1045
+ `TabItem`: `{ id: string; label: ReactNode; count?: number; badge?: ReactNode; dot?: StatusTone; href?: string; as?: ElementType; panelId?: string }`
1046
+
1047
+ `badge` shows a non-numeric count such as `<Badge tone="warning">6/8 Passing</Badge>`.
641
1048
 
642
1049
  It has two modes:
643
1050
 
644
- - **Tablist** (no item has `href`): an ARIA tablist. Arrow keys, Home and End move between tabs and select them. Render the panel yourself based on `value`.
1051
+ - **Tablist** (no item has `href`): an ARIA tablist. Arrow keys, Home and End move between tabs and select them. Give each item a `panelId` and render `<TabPanel id={panelId} active={value === item.id}>` for its content; the tab and panel are linked with `aria-controls` / `aria-labelledby`.
645
1052
  - **Navigation** (any item has `href`): a `<nav>` of links. The active link gets `aria-current="page"`. Use `as` for your router's link component.
646
1053
 
647
1054
  ```tsx
@@ -656,7 +1063,7 @@ A single-choice pill group, such as a language picker. It is an ARIA radio group
656
1063
  | Prop | Type |
657
1064
  |---|---|
658
1065
  | `label` **Req.** | `string` |
659
- | `options` **Req.** | `{ value: string; label: string; icon?: string }[]` |
1066
+ | `options` **Req.** | `{ value: string; label: string; icon?: string; hideLabel?: boolean; dot?: StatusTone }[]` (`hideLabel` shows only the icon; `label` stays the accessible name) |
660
1067
  | `value` **Req.** | `string` |
661
1068
  | `onChange` **Req.** | `(value: string) => void` |
662
1069
 
@@ -676,7 +1083,7 @@ A modal dialog rendered in a portal.
676
1083
 
677
1084
  - **Focus:** focus moves to the first focusable element in the body, Tab and Shift+Tab stay inside the dialog, and on close focus returns to the element that opened it.
678
1085
  - **Page:** the page behind can't scroll while the dialog is open.
679
- - **Theme:** the dialog inherits the opener's `<Theme>`.
1086
+ - **Theme:** the dialog uses the tone of the `<Theme>` it is rendered inside, even though it portals to `document.body`.
680
1087
  - On small screens it docks to the bottom of the viewport.
681
1088
 
682
1089
  ```tsx
@@ -693,10 +1100,14 @@ A menu button, such as an account menu.
693
1100
  |---|---|---|
694
1101
  | `label` **Req.** | `string`: the menu's accessible name | none |
695
1102
  | `trigger` **Req.** | `(props: MenuTriggerProps) => ReactNode`: spread `props` onto a `Button` | none |
696
- | `items` **Req.** | `MenuItem[]` | none |
1103
+ | `items` **Req.** | `(MenuItem \| { type: 'separator' })[]` | none |
1104
+ | `header` | `ReactNode`: above the items, e.g. the signed-in user | none |
1105
+ | `footer` | `ReactNode`: below the items | none |
697
1106
  | `align` | `'start' \| 'end'`: which edge of the trigger the menu aligns to | `'end'` |
698
1107
 
699
- `MenuItem`: `{ label: string; icon?: string; onSelect?: () => void; href?: string; as?: ElementType; tone?: 'default' | 'danger' }`
1108
+ `MenuItem`: `{ label: string; icon?: string; onSelect?: () => void; href?: string; as?: ElementType; tone?: 'default' | 'danger'; meta?: ReactNode; shortcut?: string }`
1109
+
1110
+ Separators are skipped by the keyboard.
700
1111
 
701
1112
  Keyboard and pointer behaviour:
702
1113
  - Click toggles the menu.
@@ -712,6 +1123,148 @@ Keyboard and pointer behaviour:
712
1123
  />
713
1124
  ```
714
1125
 
1126
+ #### `Checkbox`
1127
+
1128
+ A labelled native checkbox. All `<input>` props are forwarded (`checked`, `defaultChecked`, `onChange`…).
1129
+
1130
+ | Prop | Type | Default |
1131
+ |---|---|---|
1132
+ | `label` **Req.** | `ReactNode` | none |
1133
+ | `description` | `ReactNode` | none |
1134
+ | `strikeWhenChecked` | `boolean`: strike the label through when checked (task lists) | `false` |
1135
+ | `indeterminate` | `boolean` | `false` |
1136
+
1137
+ #### `Switch`
1138
+
1139
+ An on/off switch (`role="switch"`).
1140
+
1141
+ | Prop | Type |
1142
+ |---|---|
1143
+ | `label` **Req.** | `string` |
1144
+ | `checked` **Req.** | `boolean` |
1145
+ | `onChange` **Req.** | `(checked: boolean) => void` |
1146
+ | `description` | `ReactNode` |
1147
+
1148
+ #### `Disclosure`
1149
+
1150
+ A button that shows and hides a region, for example an expandable test row.
1151
+
1152
+ | Prop | Type | Default |
1153
+ |---|---|---|
1154
+ | `summary` **Req.** | `ReactNode`: the button content (keep it free of other interactive elements) | none |
1155
+ | `children` **Req.** | `ReactNode` (the revealed content) | none |
1156
+ | `open` / `onOpenChange` | controlled state | none |
1157
+ | `defaultOpen` | `boolean` (uncontrolled) | `false` |
1158
+ | `variant` | `'plain' \| 'row'` | `'plain'` |
1159
+ | `selected` | `boolean`: a cobalt left accent | `false` |
1160
+
1161
+ ```tsx
1162
+ <Disclosure variant="row" summary={<ResultRow status="fail" title="TestParkConcurrent" titleMono />}>
1163
+ <TerminalOutput lines={log} />
1164
+ </Disclosure>
1165
+ ```
1166
+
1167
+ #### `CopyButton`
1168
+
1169
+ Copies text to the clipboard and confirms for 2 seconds. A failure shows "Copy failed" and never throws.
1170
+
1171
+ | Prop | Type | Default |
1172
+ |---|---|---|
1173
+ | `value` **Req.** | `string` | none |
1174
+ | `label` | `string` | `'Copy'` |
1175
+ | `copiedLabel` | `string` | `'Copied'` |
1176
+ | `size` | `'sm' \| 'md'` | `'sm'` |
1177
+ | `variant` | `ButtonVariant` | `'secondary'` |
1178
+
1179
+ #### `Tooltip`
1180
+
1181
+ A short, non-interactive hint for its child (the trigger). It shows on hover or focus after `delay`, hides on leave, blur or Escape, and flips to stay on screen. Never put essential information only in a tooltip.
1182
+
1183
+ | Prop | Type | Default |
1184
+ |---|---|---|
1185
+ | `content` **Req.** | `ReactNode` | none |
1186
+ | `children` **Req.** | one element (the trigger) | none |
1187
+ | `side` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` |
1188
+ | `delay` | `number` (ms) | `400` |
1189
+
1190
+ ```tsx
1191
+ <Tooltip content="Reset zoom to 100%"><IconButton icon="fit_screen" label="Reset zoom" /></Tooltip>
1192
+ ```
1193
+
1194
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1195
+
1196
+ ### Navigation and overlays
1197
+
1198
+ #### `NavList`
1199
+
1200
+ Vertical navigation: an app sidebar or an in-page table of contents. The current item gets `aria-current`.
1201
+
1202
+ | Prop | Type | Default |
1203
+ |---|---|---|
1204
+ | `label` **Req.** | `string` | none |
1205
+ | `items` **Req.** | `{ id: string; label: ReactNode; icon?: string; href?: string; as?: ElementType; count?: ReactNode; onSelect?: () => void }[]` | none |
1206
+ | `current` | `string`: the current item `id` | none |
1207
+ | `heading` | `ReactNode`: a small label above the list | none |
1208
+ | `variant` | `'sidebar' \| 'toc'` | `'sidebar'` |
1209
+
1210
+ ```tsx
1211
+ <NavList label="On this page" variant="toc" current="structure" items={[{ id: 'intent', label: '1. Intent', href: '#intent' }, { id: 'structure', label: '2. Structure', href: '#structure' }]} />
1212
+ ```
1213
+
1214
+ #### `Pagination`
1215
+
1216
+ Page navigation with first/last pages, a window around the current page and `…` gaps. Out-of-range pages are clamped, and nothing renders for a single page. Below `md` it shows "‹ 3 / 12 ›".
1217
+
1218
+ | Prop | Type | Default |
1219
+ |---|---|---|
1220
+ | `page` **Req.** | `number` (1-based) | none |
1221
+ | `pageCount` **Req.** | `number` | none |
1222
+ | `onChange` **Req.** | `(page: number) => void` | none |
1223
+ | `siblingCount` | `number`: pages shown on each side of the current one | `1` |
1224
+ | `summary` | `ReactNode`, e.g. "Showing 12 of 142" | none |
1225
+ | `label` | `string` | `'Pagination'` |
1226
+
1227
+ #### `Drawer`
1228
+
1229
+ A modal slide-over panel, for example the mobile navigation. It has the same focus trap, Escape, scroll lock, focus restore and theme behaviour as `Dialog`.
1230
+
1231
+ | Prop | Type | Default |
1232
+ |---|---|---|
1233
+ | `open` **Req.** | `boolean` | none |
1234
+ | `onClose` **Req.** | `() => void` | none |
1235
+ | `title` **Req.** | `ReactNode` | none |
1236
+ | `side` | `'left' \| 'right'` | `'left'` |
1237
+ | `size` | `'sm' \| 'md'` | `'sm'` |
1238
+ | `children` | `ReactNode` | none |
1239
+
1240
+ #### `CommandPalette`
1241
+
1242
+ A ⌘K search palette: a dialog with a combobox over grouped results. You do the filtering: pass the matching `groups` for the current `query`. Up and Down move through results, Enter selects and closes, and Escape closes.
1243
+
1244
+ | Prop | Type | Default |
1245
+ |---|---|---|
1246
+ | `open` **Req.** | `boolean` | none |
1247
+ | `onClose` **Req.** | `() => void` | none |
1248
+ | `query` **Req.** | `string` | none |
1249
+ | `onQueryChange` **Req.** | `(query: string) => void` | none |
1250
+ | `groups` **Req.** | `{ label: string; items: { id: string; label: ReactNode; icon?: string; meta?: ReactNode; onSelect: () => void }[] }[]` | none |
1251
+ | `placeholder` | `string` | `'Search…'` |
1252
+ | `emptyText` | `ReactNode` | `'No results'` |
1253
+ | `label` | `string` | `'Command palette'` |
1254
+
1255
+ #### `Toaster`
1256
+
1257
+ Notification toasts. Mount `<Toaster />` once at the app root, then call `useToast().show(…)` from anywhere; toasts shown before the Toaster mounts appear once it does. Toasts are announced politely, pause while hovered or focused, and can be dismissed.
1258
+
1259
+ `useToast()` returns `{ show(options): number, dismiss(id) }`, where `options` is `{ title: ReactNode; description?: ReactNode; tone?: 'default' | 'success' | 'danger'; action?: ReactNode; duration?: number }` (default 4000ms; `Infinity` stays until dismissed).
1260
+
1261
+ ```tsx
1262
+ const { show } = useToast();
1263
+ show({ title: 'Solution saved', tone: 'success' });
1264
+ ```
1265
+
1266
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1267
+
715
1268
  ### IDE shell
716
1269
 
717
1270
  #### `Workbench`
@@ -759,7 +1312,9 @@ A keyboard-navigable file tree, built from flat paths.
759
1312
  | `activePath` | `string`: the selected file | none |
760
1313
  | `defaultExpanded` | `string[] \| 'all'` (directory paths) | `'all'` |
761
1314
 
762
- `FileNode`: `{ path: string; kind: 'file' | 'dir'; readOnly?: boolean; modified?: boolean }`
1315
+ `FileNode`: `{ path: string; kind: 'file' | 'dir'; readOnly?: boolean; modified?: boolean; icon?: string; status?: 'success' | 'warning' | 'danger' | 'info'; meta?: ReactNode }`
1316
+
1317
+ `icon` overrides the extension icon, `status` adds a named status icon ("Passing", "Failing"…), and `meta` shows trailing text such as a line count.
763
1318
 
764
1319
  - **Building the tree:** paths are `/`-separated, missing parent directories are created, and duplicate paths keep the first entry. Directories sort first, then names alphabetically.
765
1320
  - **Keyboard:** Up and Down move between items. Right expands a directory or enters it, and Left collapses it or goes to the parent. Home and End jump to the ends. Enter opens a file or toggles a directory.
@@ -808,8 +1363,10 @@ A thin bar at the bottom of the IDE.
808
1363
  |---|---|---|
809
1364
  | `label` **Req.** | `ReactNode` | none |
810
1365
  | `value` **Req.** | `ReactNode` | none |
811
- | `tone` | `'neutral' \| 'success' \| 'danger'` | `'neutral'` |
1366
+ | `tone` | `'neutral' \| 'brand' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` |
812
1367
  | `icon` | `string` | none |
1368
+ | `hint` | `ReactNode`: a line under the value, e.g. "Beats 82.4%" | none |
1369
+ | `hintTone` | `Tone` | `'muted'` |
813
1370
 
814
1371
  #### `Avatar`
815
1372
 
@@ -819,6 +1376,21 @@ A thin bar at the bottom of the IDE.
819
1376
  | `src` | `string`: the image. If it's missing or fails to load, initials show instead | none |
820
1377
  | `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
821
1378
  | `badge` | `ReactNode`, such as a score, shown at the corner | none |
1379
+ | `shape` | `'circle' \| 'square'` | `'circle'` |
1380
+ | `tone` | `'ink' \| 'brand' \| 'success' \| 'warning' \| 'danger'` (initials background) | `'ink'` |
1381
+ | `status` | `StatusTone`: a presence dot | none |
1382
+ | `statusLabel` | `string`: added to the name, e.g. "online", so the dot isn't colour-only | none |
1383
+
1384
+ #### `AvatarGroup`
1385
+
1386
+ Overlapping avatars, with any beyond `max` collapsed into "+N".
1387
+
1388
+ | Prop | Type | Default |
1389
+ |---|---|---|
1390
+ | `children` **Req.** | `Avatar` elements | none |
1391
+ | `max` | `number` | all |
1392
+ | `size` | `'sm' \| 'md' \| 'lg'` (applied to every avatar) | `'md'` |
1393
+ | `label` | `string`: the group's accessible name | none |
822
1394
 
823
1395
  #### `Countdown`
824
1396
 
@@ -835,8 +1407,72 @@ A timer that counts down, or up.
835
1407
 
836
1408
  It shows `mm:ss`, or `h:mm:ss` from one hour. A deadline already in the past shows `00:00` and fires `onExpire` right away. Unmounting stops the timer, and `onExpire` won't fire afterwards.
837
1409
 
1410
+ #### `UmlClass`
1411
+
1412
+ A UML class box: name (with an optional «stereotype»), attributes and methods.
1413
+
1414
+ | Prop | Type | Default |
1415
+ |---|---|---|
1416
+ | `name` **Req.** | `string` | none |
1417
+ | `stereotype` | `string`, e.g. `'interface'` | none |
1418
+ | `attributes` | `string[]` | `[]` |
1419
+ | `methods` | `string[]` | `[]` |
1420
+ | `tag` | `ReactNode`: under the name | none |
1421
+ | `emphasis` | `'default' \| 'brand' \| 'strong'` (border weight and colour) | `'default'` |
1422
+ | `size` | `'sm' \| 'md'` | `'md'` |
1423
+ | `dashed` | `boolean` | `false` |
1424
+
1425
+ #### `UmlDiagram`
1426
+
1427
+ A class diagram laid out automatically (dagre), with UML relationship arrows, zoom and pan. Screen readers get a text description of every class and relationship.
1428
+
1429
+ | Prop | Type | Default |
1430
+ |---|---|---|
1431
+ | `label` **Req.** | `string` | none |
1432
+ | `nodes` **Req.** | `{ id: string; name: string; stereotype?; attributes?; methods?; tag?; emphasis?; dashed? }[]` | none |
1433
+ | `edges` **Req.** | `{ from: string; to: string; kind: 'association' \| 'dependency' \| 'realization' \| 'inheritance' \| 'aggregation' \| 'composition'; label?: string; fromMultiplicity?: string; toMultiplicity?: string }[]` | none |
1434
+ | `direction` | `'TB' \| 'LR'` | `'TB'` |
1435
+ | `zoomable` | `boolean`: zoom buttons (50–200%) | `true` |
1436
+ | `compact` | `boolean`: small inline diagram, no zoom controls, scaled to fit the width | `false` |
1437
+ | `pattern` | `'dots' \| 'none'` | `'dots'` |
1438
+
1439
+ - **Layout:** the class boxes are measured, then laid out after mount (safe with server rendering). A simple wrapped grid shows until the layout is ready.
1440
+ - **Pan:** the diagram scrolls inside itself; focus it and use the arrow keys, or scroll.
1441
+ - **Arrows:** association and dependency use an open arrow (dependency dashed), inheritance and realization a hollow triangle (realization dashed), aggregation a hollow diamond and composition a filled diamond at the `from` end.
1442
+
1443
+ ```tsx
1444
+ <UmlDiagram
1445
+ label="Strategy pattern"
1446
+ nodes={[{ id: 'ctx', name: 'PricingContext' }, { id: 's', name: 'Strategy', stereotype: 'interface' }, { id: 'h', name: 'HourlyStrategy' }]}
1447
+ edges={[{ from: 'ctx', to: 's', kind: 'aggregation' }, { from: 'h', to: 's', kind: 'realization' }]}
1448
+ />
1449
+ ```
1450
+
838
1451
  ---
839
1452
 
1453
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1454
+
1455
+ ## Mobile navigation
1456
+
1457
+ Every header hides its navigation below a breakpoint and opens a `Drawer` instead. With `Show` this needs no custom CSS:
1458
+
1459
+ ```tsx
1460
+ const [open, setOpen] = useState(false);
1461
+
1462
+ <AppBar
1463
+ start={<Logo />}
1464
+ center={<Show above="lg"><Tabs label="Site" value={current} items={navTabs} /></Show>}
1465
+ end={<Show below="lg"><IconButton icon="menu" label="Open menu" onClick={() => setOpen(true)} /></Show>}
1466
+ />
1467
+ <Drawer open={open} onClose={() => setOpen(false)} title="LLD Lab">
1468
+ <NavList label="Site" items={navItems} current={current} />
1469
+ </Drawer>
1470
+ ```
1471
+
1472
+ For sticky side rails under a sticky `AppBar`, use `Split sticky stickyOffset="appbar"`.
1473
+
1474
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1475
+
840
1476
  ## Design tokens
841
1477
 
842
1478
  `theme.css` registers every token as a Tailwind v4 theme variable, so it is available both as a utility (`bg-surface`) and as a CSS variable (`var(--color-surface)`). Use the variables in the app's own CSS when you need them outside components.
@@ -851,20 +1487,29 @@ It shows `mm:ss`, or `h:mm:ss` from one hour. A deadline already in the past sho
851
1487
  | Badges | `--color-badge-{beginner,intermediate,amber,advanced}-{bg,text}` |
852
1488
  | Spacing | `--spacing-space-{2xs,xs,sm,md,lg,xl,2xl}`, `--spacing-gutter-fluid`, `--spacing-section-{md,lg,xl}` |
853
1489
  | Type | `--text-{display,headline-xl,headline-lg,headline-md,headline-sm,body-lead,body-md,body-sm,label-mono,code-inline,button-text}` |
1490
+ | Code (syntax highlighting) | `--color-code-{keyword,string,number,comment,function,type,punctuation,plain}`, `--color-code-bg-subtle`; the `code-subtle` utility swaps them for a light surface |
1491
+ | Diff | `--color-diff-{add,del}-{bg,fg}` |
1492
+ | App bar | `--spacing-appbar` (4rem, the md `AppBar` height used by `stickyOffset="appbar"`) |
1493
+ | Utilities | `bg-pattern-dots`, `bg-pattern-grid`, `icon-filled`, `skeleton-shimmer` |
1494
+
1495
+ Every token under Surfaces, Text, Status text, Borders and Badges changes inside `[data-theme="dark"]`. `<Theme tone="dark">` renders that attribute, and so do `Card`, `Box` and `Section` with `tone="inverse"`.
854
1496
 
855
- Every token under Surfaces, Text, Status text, Borders and Badges changes inside `[data-theme="dark"]`, which is what `<Theme tone="dark">` renders.
1497
+ <sub>[↑ Back to top](#table-of-contents)</sub>
856
1498
 
857
1499
  ## Accessibility
858
1500
 
859
1501
  - **Interactive widgets:** they follow the WAI-ARIA Authoring Practices.
860
1502
  - `Tabs` is a tablist, `SegmentedControl` a radio group, and `Menu` a menu button.
861
1503
  - `FileTree` is a tree view, and the `Workbench` resize handles are separators with values.
862
- - `Dialog` is a modal dialog.
1504
+ - `Dialog`, `Drawer` and `CommandPalette` are modal dialogs; `CommandPalette` uses the combobox pattern.
1505
+ - `Disclosure` is a disclosure button, `Switch` a switch, `Tooltip` a tooltip, and `Timeline` marks the current step.
863
1506
  - **Accessible names:** icon-only controls require a `label` (`IconButton`), and status icons have names (`ResultRow`).
864
1507
  - **Focus and touch:** focus rings are visible on keyboard focus, and touch targets are at least 44px below `md`.
865
1508
  - **Contrast:** status text colours meet WCAG AA in both themes.
866
1509
  - **CI checks:** every gallery story runs through axe, and critical or serious violations fail the build.
867
1510
 
1511
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1512
+
868
1513
  ## Troubleshooting
869
1514
 
870
1515
  | Symptom | Fix |
@@ -873,8 +1518,12 @@ Every token under Surfaces, Text, Status text, Borders and Badges changes inside
873
1518
  | Icons show as words (`play_arrow`) | Load the Material Symbols Outlined stylesheet. |
874
1519
  | Wrong fonts | Set `--font-space-grotesk`, `--font-inter` and `--font-jetbrains-mono`, for example on `<html>` through `next/font`'s `variable` option. |
875
1520
  | TypeScript error on `className` | This is intentional: use a variant prop, or add a variant to the library. |
1521
+ | Toasts never appear | Mount `<Toaster />` once at the app root. |
1522
+ | `UmlDiagram` shows boxes in a plain grid | The layout runs after mount; if it never arrives, check that `@dagrejs/dagre` is installed (it's a dependency of `lldlab-ui`). |
876
1523
  | `Workbench` has no height | Give its parent an explicit height, e.g. `h-dvh`, or make it a flex child with `min-h-0 flex-1`. |
877
1524
 
1525
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1526
+
878
1527
  ## Development
879
1528
 
880
1529
  ```bash
@@ -895,6 +1544,8 @@ When adding a component:
895
1544
  2. Keep `className` and `style` out of its props.
896
1545
  3. Add a unit test and a story.
897
1546
 
1547
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1548
+
898
1549
  ## Releasing
899
1550
 
900
1551
  ```bash
@@ -904,6 +1555,10 @@ git push --follow-tags # the v* tag runs .github/workflows/release.yml
904
1555
 
905
1556
  The release workflow checks that the tag matches `package.json`, runs the tests, builds, and publishes through **npm Trusted Publishing** (GitHub OIDC) with provenance. No npm token is stored.
906
1557
 
1558
+ <sub>[↑ Back to top](#table-of-contents)</sub>
1559
+
907
1560
  ## License
908
1561
 
909
1562
  MIT
1563
+
1564
+ <sub>[↑ Back to top](#table-of-contents)</sub>