lldlab-ui 0.1.0 → 0.2.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 +657 -51
- package/dist/index.d.ts +757 -66
- package/dist/index.js +1813 -315
- package/dist/index.js.map +1 -1
- package/dist/theme.css +85 -0
- package/package.json +30 -12
package/README.md
CHANGED
|
@@ -10,22 +10,30 @@ Design-system components for [LLD Lab](https://lldlab.com), built for React 19 a
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
13
|
+
## Table of contents
|
|
14
|
+
|
|
15
|
+
**Quick links:** [Install](#install) · [Setup](#setup) · [Component index](#component-index) · [Mobile navigation](#mobile-navigation) · [Design tokens](#design-tokens) · [Troubleshooting](#troubleshooting)
|
|
16
|
+
|
|
17
|
+
1. [Install](#install)
|
|
18
|
+
2. [Setup](#setup)
|
|
19
|
+
- [1. Styles](#1-styles) · [2. Fonts](#2-fonts) · [3. Icons](#3-icons) · [4. Use it](#4-use-it)
|
|
20
|
+
3. [Core concepts](#core-concepts)
|
|
21
|
+
- [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)
|
|
22
|
+
4. [Components](#components)
|
|
23
|
+
- [Component index](#component-index)
|
|
24
|
+
- **[Layout](#layout):** [`Theme`](#theme) · [`Box`](#box) · [`Stack`](#stack) · [`Grid`](#grid) · [`Container`](#container) · [`Section`](#section) · [`Split`](#split) · [`AppBar`](#appbar) · [`Show`](#show) · [`Divider`](#divider)
|
|
25
|
+
- **[Typography](#typography):** [`Text`](#text) · [`Heading`](#heading) · [`Eyebrow`](#eyebrow) · [`Code`](#code) · [`CodeBlock`](#codeblock) · [`TextLink`](#textlink) · [`Markdown`](#markdown)
|
|
26
|
+
- **[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)
|
|
27
|
+
- **[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)
|
|
28
|
+
- **[Navigation and overlays](#navigation-and-overlays):** [`NavList`](#navlist) · [`Pagination`](#pagination) · [`Drawer`](#drawer) · [`CommandPalette`](#commandpalette) · [`Toaster`](#toaster)
|
|
29
|
+
- **[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)
|
|
30
|
+
5. [Mobile navigation](#mobile-navigation)
|
|
31
|
+
6. [Design tokens](#design-tokens)
|
|
32
|
+
7. [Accessibility](#accessibility)
|
|
33
|
+
8. [Troubleshooting](#troubleshooting)
|
|
34
|
+
9. [Development](#development)
|
|
35
|
+
10. [Releasing](#releasing)
|
|
36
|
+
11. [License](#license)
|
|
29
37
|
|
|
30
38
|
---
|
|
31
39
|
|
|
@@ -42,6 +50,10 @@ npm install lldlab-ui
|
|
|
42
50
|
|
|
43
51
|
The package is ESM-only and ships TypeScript types.
|
|
44
52
|
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
56
|
+
|
|
45
57
|
## Setup
|
|
46
58
|
|
|
47
59
|
### 1. Styles
|
|
@@ -134,6 +146,8 @@ The bundle starts with `'use client'`, so any component can be imported from a N
|
|
|
134
146
|
|
|
135
147
|
---
|
|
136
148
|
|
|
149
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
150
|
+
|
|
137
151
|
## Core concepts
|
|
138
152
|
|
|
139
153
|
### No `className`, no `style`
|
|
@@ -200,7 +214,7 @@ These types are exported from the package.
|
|
|
200
214
|
| `StatusTone` (dots, eyebrows, section headers) | `neutral` · `brand` · `success` · `warning` · `danger` |
|
|
201
215
|
| `SurfaceTone` (backgrounds) | `surface` · `subtle` · `elevated` · `low` · `inverse` |
|
|
202
216
|
| `BadgeTone` | `neutral` · `brand` · `success` · `warning` · `danger` · `info` |
|
|
203
|
-
| `ButtonVariant` | `primary` · `secondary` · `subtle` · `ghost` · `danger` |
|
|
217
|
+
| `ButtonVariant` | `primary` · `secondary` · `subtle` · `ghost` · `danger` · `brand` (cobalt) · `accent` (crimson call to action, not destructive) |
|
|
204
218
|
|
|
205
219
|
### Light and dark scopes
|
|
206
220
|
|
|
@@ -215,10 +229,89 @@ Components use semantic tokens only, so every component works in both scopes. A
|
|
|
215
229
|
|
|
216
230
|
---
|
|
217
231
|
|
|
232
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
233
|
+
|
|
218
234
|
## Components
|
|
219
235
|
|
|
220
236
|
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
237
|
|
|
238
|
+
### Component index
|
|
239
|
+
|
|
240
|
+
| Component | Group | Use it for |
|
|
241
|
+
|---|---|---|
|
|
242
|
+
| [`Theme`](#theme) | Layout | Scope light/dark tokens for a subtree |
|
|
243
|
+
| [`Box`](#box) | Layout | Generic surface: padding, tone, radius, border |
|
|
244
|
+
| [`Stack`](#stack) | Layout | Flex row/column with gaps |
|
|
245
|
+
| [`Grid`](#grid) | Layout | Responsive CSS grid |
|
|
246
|
+
| [`Container`](#container) | Layout | Centred page column with fluid gutters |
|
|
247
|
+
| [`Section`](#section) | Layout | Full-width page band |
|
|
248
|
+
| [`Split`](#split) | Layout | Main content + aside (+ optional start rail) |
|
|
249
|
+
| [`AppBar`](#appbar) | Layout | Sticky site/app header |
|
|
250
|
+
| [`Show`](#show) | Layout | Show only above/below a breakpoint |
|
|
251
|
+
| [`Divider`](#divider) | Layout | Horizontal/vertical rule, "or" divider |
|
|
252
|
+
| [`Text`](#text) | Typography | Body, label and code text |
|
|
253
|
+
| [`Heading`](#heading) | Typography | h1–h4 with fluid sizes |
|
|
254
|
+
| [`Eyebrow`](#eyebrow) | Typography | Pill label above a heading |
|
|
255
|
+
| [`Code`](#code) | Typography | Inline code |
|
|
256
|
+
| [`CodeBlock`](#codeblock) | Typography | Code block with highlighting |
|
|
257
|
+
| [`TextLink`](#textlink) | Typography | Inline text link |
|
|
258
|
+
| [`Markdown`](#markdown) | Typography | Safe markdown rendering |
|
|
259
|
+
| [`Icon`](#icon) | Display | Material Symbols icon |
|
|
260
|
+
| [`Dot`](#dot) | Display | Status dot |
|
|
261
|
+
| [`Badge`](#badge) | Display | Small status/label pill |
|
|
262
|
+
| [`Chip`](#chip) | Display | Removable tag |
|
|
263
|
+
| [`Stat`](#stat) | Display | Icon + label + value |
|
|
264
|
+
| [`ProgressBar`](#progressbar) | Display | Labelled progress |
|
|
265
|
+
| [`SectionHeader`](#sectionheader) | Display | Header row for a group |
|
|
266
|
+
| [`Callout`](#callout) | Display | Tinted notice box |
|
|
267
|
+
| [`ResultRow`](#resultrow) | Display | Test result / review row |
|
|
268
|
+
| [`Message`](#message) | Display | Loading/empty/error line |
|
|
269
|
+
| [`EmptyState`](#emptystate) | Display | Empty, 404 and error blocks |
|
|
270
|
+
| [`CheckList`](#checklist) | Display | List with check (or cross) icons |
|
|
271
|
+
| [`Card`](#card) | Display | Card with header/media/footer slots |
|
|
272
|
+
| [`IconTile`](#icontile) | Display | Icon in a tinted tile |
|
|
273
|
+
| [`Skeleton`](#skeleton) | Display | Loading placeholder |
|
|
274
|
+
| [`Table`](#table) | Display | Semantic, scrollable table |
|
|
275
|
+
| [`DescriptionList`](#descriptionlist) | Display | Term / detail pairs |
|
|
276
|
+
| [`Timeline`](#timeline) | Display | Steps and events with status |
|
|
277
|
+
| [`BarChart`](#barchart) | Display | Small accessible bar chart |
|
|
278
|
+
| [`VerdictBanner`](#verdictbanner) | Display | Result hero ("Accepted") |
|
|
279
|
+
| [`TerminalOutput`](#terminaloutput) | Display | Toned log output |
|
|
280
|
+
| [`DiffViewer`](#diffviewer) | Display | Unified/split line diff |
|
|
281
|
+
| [`Overlay`](#overlay) | Display | Blur and lock content (gates) |
|
|
282
|
+
| [`Button`](#button) | Inputs and interaction | Buttons and link buttons |
|
|
283
|
+
| [`IconButton`](#iconbutton) | Inputs and interaction | Icon-only button or link |
|
|
284
|
+
| [`Kbd`](#kbd) | Inputs and interaction | Keyboard hint |
|
|
285
|
+
| [`TextField`](#textfield) | Inputs and interaction | Labelled text input |
|
|
286
|
+
| [`Select`](#select) | Inputs and interaction | Native select |
|
|
287
|
+
| [`Tabs`](#tabs) | Inputs and interaction | Tablist or nav tabs |
|
|
288
|
+
| [`SegmentedControl`](#segmentedcontrol) | Inputs and interaction | Single-choice pills |
|
|
289
|
+
| [`Dialog`](#dialog) | Inputs and interaction | Modal dialog |
|
|
290
|
+
| [`Menu`](#menu) | Inputs and interaction | Menu button |
|
|
291
|
+
| [`Checkbox`](#checkbox) | Inputs and interaction | Labelled checkbox |
|
|
292
|
+
| [`Switch`](#switch) | Inputs and interaction | On/off switch |
|
|
293
|
+
| [`Disclosure`](#disclosure) | Inputs and interaction | Expandable region |
|
|
294
|
+
| [`CopyButton`](#copybutton) | Inputs and interaction | Copy text to clipboard |
|
|
295
|
+
| [`Tooltip`](#tooltip) | Inputs and interaction | Short hover/focus hint |
|
|
296
|
+
| [`NavList`](#navlist) | Navigation and overlays | Sidebar / table of contents |
|
|
297
|
+
| [`Pagination`](#pagination) | Navigation and overlays | Page navigation |
|
|
298
|
+
| [`Drawer`](#drawer) | Navigation and overlays | Slide-over panel (mobile nav) |
|
|
299
|
+
| [`CommandPalette`](#commandpalette) | Navigation and overlays | ⌘K search palette |
|
|
300
|
+
| [`Toaster`](#toaster) | Navigation and overlays | Toast notifications (useToast) |
|
|
301
|
+
| [`Workbench`](#workbench) | IDE shell | Resizable IDE layout |
|
|
302
|
+
| [`FileTree`](#filetree) | IDE shell | Keyboard file tree |
|
|
303
|
+
| [`EditorTabs`](#editortabs) | IDE shell | Open-file tabs |
|
|
304
|
+
| [`Breadcrumbs`](#breadcrumbs) | IDE shell | Breadcrumb trail |
|
|
305
|
+
| [`StatusBar`](#statusbar) | IDE shell | IDE status bar |
|
|
306
|
+
| [`MetricTile`](#metrictile) | IDE shell | Label + big value |
|
|
307
|
+
| [`Avatar`](#avatar) | IDE shell | User avatar |
|
|
308
|
+
| [`AvatarGroup`](#avatargroup) | IDE shell | Overlapping avatars |
|
|
309
|
+
| [`Countdown`](#countdown) | IDE shell | Countdown / elapsed timer |
|
|
310
|
+
| [`UmlClass`](#umlclass) | IDE shell | UML class box |
|
|
311
|
+
| [`UmlDiagram`](#umldiagram) | IDE shell | Auto-laid-out class diagram |
|
|
312
|
+
|
|
313
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
314
|
+
|
|
222
315
|
### Layout
|
|
223
316
|
|
|
224
317
|
#### `Theme`
|
|
@@ -245,6 +338,9 @@ A generic surface. Polymorphic, default `div`.
|
|
|
245
338
|
| `radius` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` |
|
|
246
339
|
| `border` | `'none' \| 'subtle' \| 'strong'` | `'none'` |
|
|
247
340
|
| `shadow` | `'none' \| 'sm' \| 'md'` | `'none'` |
|
|
341
|
+
| `dimmed` | `boolean`: greys the content out and makes it `inert` (for example, a panel waiting on a runtime) | `false` |
|
|
342
|
+
|
|
343
|
+
`tone="inverse"` also switches its contents to the dark tokens (`data-theme="dark"`), so text and badges inside stay readable.
|
|
248
344
|
|
|
249
345
|
```tsx
|
|
250
346
|
<Box tone="elevated" border="subtle" radius="lg" padding={{ base: 'md', lg: 'lg' }}>…</Box>
|
|
@@ -300,6 +396,8 @@ A full-width page band with fluid vertical padding. Polymorphic, default `sectio
|
|
|
300
396
|
| `padding` | `'md' \| 'lg' \| 'xl'`: fluid, about 2–4rem, 3–6rem and 4–8rem | `'lg'` |
|
|
301
397
|
| `pattern` | `'none' \| 'dots' \| 'grid'` | `'none'` |
|
|
302
398
|
|
|
399
|
+
`tone="inverse"` scopes the dark tokens for its contents, like `Box`.
|
|
400
|
+
|
|
303
401
|
```tsx
|
|
304
402
|
<Section tone="subtle" pattern="dots" padding="xl">
|
|
305
403
|
<Container>…</Container>
|
|
@@ -315,7 +413,9 @@ Main content plus an aside, side by side from `xl` and stacked below it.
|
|
|
315
413
|
| `aside` **Req.** | `ReactNode` | none |
|
|
316
414
|
| `children` **Req.** | `ReactNode` (main content) | none |
|
|
317
415
|
| `ratio` | `'8/4' \| '1/1' \| '9/3'` (out of 12 columns) | `'8/4'` |
|
|
318
|
-
| `sticky` | `boolean`: the aside
|
|
416
|
+
| `sticky` | `boolean`: the aside (and `start`) stick while scrolling | `false` |
|
|
417
|
+
| `stickyOffset` | `'none' \| 'appbar'`: `appbar` sticks below a 64px `AppBar` | `'none'` |
|
|
418
|
+
| `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
419
|
| `gap` | `Responsive<Space>` | `'lg'` |
|
|
320
420
|
|
|
321
421
|
```tsx
|
|
@@ -324,6 +424,55 @@ Main content plus an aside, side by side from `xl` and stacked below it.
|
|
|
324
424
|
</Split>
|
|
325
425
|
```
|
|
326
426
|
|
|
427
|
+
#### `AppBar`
|
|
428
|
+
|
|
429
|
+
A site or app header bar with `start`, `center` and `end` slots.
|
|
430
|
+
|
|
431
|
+
| Prop | Type | Default |
|
|
432
|
+
|---|---|---|
|
|
433
|
+
| `start` | `ReactNode` (logo) | none |
|
|
434
|
+
| `center` | `ReactNode` (navigation, search) | none |
|
|
435
|
+
| `end` | `ReactNode` (actions, account) | none |
|
|
436
|
+
| `position` | `'sticky' \| 'fixed' \| 'static'` | `'sticky'` |
|
|
437
|
+
| `height` | `'sm' \| 'md'` (48px / 64px) | `'md'` |
|
|
438
|
+
| `blur` | `boolean`: translucent background with backdrop blur | `true` |
|
|
439
|
+
| `contained` | `boolean`: constrain the content to the 80rem page column | `true` |
|
|
440
|
+
|
|
441
|
+
```tsx
|
|
442
|
+
<AppBar start={<Logo />} center={<Tabs label="Site" value="problems" items={navTabs} />} end={<IconButton icon="notifications" label="Notifications" />} />
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
#### `Show`
|
|
446
|
+
|
|
447
|
+
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`.
|
|
448
|
+
|
|
449
|
+
| Prop | Type |
|
|
450
|
+
|---|---|
|
|
451
|
+
| `above` | `'sm' \| 'md' \| 'lg' \| 'xl'`: render from this breakpoint up |
|
|
452
|
+
| `below` | `'sm' \| 'md' \| 'lg' \| 'xl'`: render only below this breakpoint |
|
|
453
|
+
| `children` **Req.** | `ReactNode` |
|
|
454
|
+
|
|
455
|
+
```tsx
|
|
456
|
+
<Show above="lg"><Tabs … /></Show>
|
|
457
|
+
<Show below="lg"><IconButton icon="menu" label="Open menu" onClick={openDrawer} /></Show>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### `Divider`
|
|
461
|
+
|
|
462
|
+
A horizontal or vertical rule, optionally with a centred label (the "or" divider).
|
|
463
|
+
|
|
464
|
+
| Prop | Type | Default |
|
|
465
|
+
|---|---|---|
|
|
466
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` |
|
|
467
|
+
| `label` | `ReactNode` (horizontal only) | none |
|
|
468
|
+
| `spacing` | `Space`: margin on both sides of the rule | `'none'` |
|
|
469
|
+
|
|
470
|
+
```tsx
|
|
471
|
+
<Divider label="or" spacing="md" />
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
475
|
+
|
|
327
476
|
### Typography
|
|
328
477
|
|
|
329
478
|
#### `Text`
|
|
@@ -332,11 +481,14 @@ Body text. Polymorphic, default `p`.
|
|
|
332
481
|
|
|
333
482
|
| Prop | Type | Default |
|
|
334
483
|
|---|---|---|
|
|
335
|
-
| `variant` | `'body-lead' \| 'body-md' \| 'body-sm' \| 'label' \| 'code'` | `'body-md'` |
|
|
484
|
+
| `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
485
|
| `tone` | `Tone` | `'default'` |
|
|
337
486
|
| `weight` | `'regular' \| 'medium' \| 'semibold'` | `'regular'` |
|
|
338
487
|
| `truncate` | `boolean`: a single line with an ellipsis | `false` |
|
|
339
488
|
| `clamp` | `1 \| 2 \| 3 \| 4`: the number of lines before an ellipsis | none |
|
|
489
|
+
| `align` | `'start' \| 'center' \| 'end'` | none |
|
|
490
|
+
| `measure` | `boolean`: limit the line length to a readable width | `false` |
|
|
491
|
+
| `uppercase` | `boolean` | `true` for `label`, `false` otherwise |
|
|
340
492
|
|
|
341
493
|
`label` is JetBrains Mono in uppercase. Long words wrap instead of overflowing.
|
|
342
494
|
|
|
@@ -350,7 +502,9 @@ Body text. Polymorphic, default `p`.
|
|
|
350
502
|
|---|---|---|
|
|
351
503
|
| `level` **Req.** | `1 \| 2 \| 3 \| 4`: which element (`h1`–`h4`) | none |
|
|
352
504
|
| `size` | `Responsive<HeadingSize>` | from the level: 1→`xl`, 2→`lg`, 3→`md`, 4→`sm` |
|
|
353
|
-
| `tone` | `'default' \| 'muted' \| 'brand' \| 'inverse'` | `'default'` |
|
|
505
|
+
| `tone` | `'default' \| 'muted' \| 'brand' \| 'inverse' \| 'success' \| 'danger' \| 'warning'` | `'default'` |
|
|
506
|
+
| `truncate` | `boolean`: a single line with an ellipsis | `false` |
|
|
507
|
+
| `align` | `'start' \| 'center'` | `'start'` |
|
|
354
508
|
|
|
355
509
|
`display`, `xl` and `lg` scale fluidly with the viewport. `level` sets the document outline and `size` sets the look, so they are independent.
|
|
356
510
|
|
|
@@ -366,6 +520,8 @@ A small uppercase pill with a status dot, used above hero headings.
|
|
|
366
520
|
|---|---|---|
|
|
367
521
|
| `children` **Req.** | `ReactNode` | none |
|
|
368
522
|
| `tone` | `StatusTone` (the dot colour) | `'brand'` |
|
|
523
|
+
| `pulse` | `boolean`: pulsing dot | `false` |
|
|
524
|
+
| `variant` | `'pill' \| 'plain'` (`plain` has no border or background) | `'pill'` |
|
|
369
525
|
|
|
370
526
|
#### `Code`
|
|
371
527
|
|
|
@@ -373,12 +529,38 @@ Inline code. Props: `children`.
|
|
|
373
529
|
|
|
374
530
|
#### `CodeBlock`
|
|
375
531
|
|
|
376
|
-
A
|
|
532
|
+
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.
|
|
377
533
|
|
|
378
534
|
| Prop | Type | Default |
|
|
379
535
|
|---|---|---|
|
|
380
|
-
| `children` **Req.** | `ReactNode` (the code) | none |
|
|
381
|
-
| `language` | `string`: shown as
|
|
536
|
+
| `children` **Req.** | `ReactNode` (the code; a `string` for `highlight` and `lineNumbers`) | none |
|
|
537
|
+
| `language` | `string`: the language, shown as the caption when there's no `title` | none |
|
|
538
|
+
| `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` |
|
|
539
|
+
| `title` | `ReactNode`: header text, such as a file name | none |
|
|
540
|
+
| `meta` | `ReactNode`: next to the title, such as a `Badge` | none |
|
|
541
|
+
| `actions` | `ReactNode`: right side of the header, such as a `CopyButton` | none |
|
|
542
|
+
| `lineNumbers` | `boolean` | `false` |
|
|
543
|
+
| `tone` | `'dark' \| 'subtle'` (`subtle` is a light surface in the light theme) | `'dark'` |
|
|
544
|
+
|
|
545
|
+
```tsx
|
|
546
|
+
<CodeBlock language="go" highlight lineNumbers title="lot.go" actions={<CopyButton value={code} />}>{code}</CodeBlock>
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
#### `TextLink`
|
|
550
|
+
|
|
551
|
+
An inline text link. Polymorphic, default `a`.
|
|
552
|
+
|
|
553
|
+
| Prop | Type | Default |
|
|
554
|
+
|---|---|---|
|
|
555
|
+
| `children` **Req.** | `ReactNode` | none |
|
|
556
|
+
| `tone` | `'brand' \| 'default' \| 'muted' \| 'danger' \| 'success' \| 'warning'` | `'brand'` |
|
|
557
|
+
| `size` | `'sm' \| 'md'` | `'md'` |
|
|
558
|
+
| `icon` / `iconRight` | `string` | none |
|
|
559
|
+
| `underline` | `'hover' \| 'always' \| 'none'` | `'hover'` |
|
|
560
|
+
|
|
561
|
+
```tsx
|
|
562
|
+
<TextLink as={Link} href="/patterns" iconRight="arrow_forward">View all patterns</TextLink>
|
|
563
|
+
```
|
|
382
564
|
|
|
383
565
|
#### `Markdown`
|
|
384
566
|
|
|
@@ -394,6 +576,8 @@ Raw HTML in the source is **not** rendered, and `javascript:` links are stripped
|
|
|
394
576
|
<Markdown>{problem.statement}</Markdown>
|
|
395
577
|
```
|
|
396
578
|
|
|
579
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
580
|
+
|
|
397
581
|
### Display
|
|
398
582
|
|
|
399
583
|
#### `Icon`
|
|
@@ -427,6 +611,9 @@ A small coloured status dot, always decorative.
|
|
|
427
611
|
| `tone` | `BadgeTone` | `'neutral'` |
|
|
428
612
|
| `size` | `'sm' \| 'md'` | `'sm'` |
|
|
429
613
|
| `uppercase` | `boolean` | `false` |
|
|
614
|
+
| `icon` | `string`: a leading icon | none |
|
|
615
|
+
| `dot` | `StatusTone`: a leading status dot | none |
|
|
616
|
+
| `pulse` | `boolean`: pulses the dot | `false` |
|
|
430
617
|
|
|
431
618
|
```tsx
|
|
432
619
|
<Badge tone="success" uppercase>Beginner</Badge>
|
|
@@ -439,8 +626,9 @@ An outlined tag, such as a pattern category. It can be removable.
|
|
|
439
626
|
| Prop | Type | Default |
|
|
440
627
|
|---|---|---|
|
|
441
628
|
| `children` **Req.** | `string` | none |
|
|
442
|
-
| `tone` | `'neutral' \| 'brand'` | `'neutral'` |
|
|
629
|
+
| `tone` | `'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` |
|
|
443
630
|
| `icon` | `string` | none |
|
|
631
|
+
| `dot` | `StatusTone` or any CSS colour (e.g. a language's brand colour `"#00ADD8"`) | none |
|
|
444
632
|
| `onRemove` | `() => void`: shows a remove button named "Remove {children}" | none |
|
|
445
633
|
|
|
446
634
|
#### `Stat`
|
|
@@ -457,11 +645,14 @@ An icon with a small label above a large value.
|
|
|
457
645
|
|
|
458
646
|
| Prop | Type | Default |
|
|
459
647
|
|---|---|---|
|
|
460
|
-
| `label` **Req.** | `
|
|
648
|
+
| `label` **Req.** | `ReactNode`: the visible label, which also names the bar | none |
|
|
461
649
|
| `value` **Req.** | `number` | none |
|
|
462
650
|
| `max` | `number` | `100` |
|
|
463
651
|
| `tone` | `'brand' \| 'success' \| 'warning' \| 'danger'` | `'brand'` |
|
|
464
652
|
| `hideLabel` | `boolean`: keeps the label for screen readers only | `false` |
|
|
653
|
+
| `valueLabel` | `ReactNode`: replaces the percentage, e.g. "7 of 12" | the percentage |
|
|
654
|
+
| `caption` | `ReactNode`: a line below the bar | none |
|
|
655
|
+
| `size` | `'sm' \| 'md'` (4px / 6px bar) | `'md'` |
|
|
465
656
|
|
|
466
657
|
`value` is clamped to `0…max`. A `max` of 0 or less shows 0%.
|
|
467
658
|
|
|
@@ -471,19 +662,24 @@ An icon with a small label above a large value.
|
|
|
471
662
|
|
|
472
663
|
#### `SectionHeader`
|
|
473
664
|
|
|
474
|
-
A header row for a group of items: dot, heading, tag
|
|
665
|
+
A header row for a group of items: icon, dot, heading, tag, a right-aligned meta line and an optional description.
|
|
475
666
|
|
|
476
667
|
| Prop | Type | Default |
|
|
477
668
|
|---|---|---|
|
|
478
669
|
| `title` **Req.** | `ReactNode` | none |
|
|
479
670
|
| `level` | `2 \| 3` | `2` |
|
|
671
|
+
| `size` | `'sm' \| 'md'` (the heading size) | `'sm'` |
|
|
480
672
|
| `dot` | `StatusTone` | none |
|
|
673
|
+
| `icon` | `string`: shown in an `IconTile` | none |
|
|
481
674
|
| `tag` | `ReactNode`: shown as an uppercase badge | none |
|
|
675
|
+
| `tagTone` | `BadgeTone` | `'neutral'` |
|
|
482
676
|
| `meta` | `ReactNode` | none |
|
|
677
|
+
| `description` | `ReactNode`: a full-width line below | none |
|
|
678
|
+
| `accent` | `StatusTone`: a 2px coloured underline instead of the hairline | none |
|
|
483
679
|
|
|
484
680
|
#### `Callout`
|
|
485
681
|
|
|
486
|
-
A tinted notice box. `danger` is announced as an alert, and the other tones as a status.
|
|
682
|
+
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
683
|
|
|
488
684
|
| Prop | Type | Default |
|
|
489
685
|
|---|---|---|
|
|
@@ -491,17 +687,25 @@ A tinted notice box. `danger` is announced as an alert, and the other tones as a
|
|
|
491
687
|
| `tone` | `'info' \| 'success' \| 'warning' \| 'danger'` | `'info'` |
|
|
492
688
|
| `title` | `ReactNode` | none |
|
|
493
689
|
| `action` | `ReactNode`, such as a `Button` | none |
|
|
690
|
+
| `live` | `boolean`: announce as alert/status | `true` |
|
|
691
|
+
| `icon` | `string`: overrides the tone's icon | tone icon |
|
|
692
|
+
| `size` | `'sm' \| 'md'` (`sm` suits inline form errors) | `'md'` |
|
|
693
|
+
| `accent` | `boolean`: a thick left border | `false` |
|
|
494
694
|
|
|
495
695
|
#### `ResultRow`
|
|
496
696
|
|
|
497
|
-
One test result or submission row. The status icon carries an accessible name: "Passed", "Failed" or "Pending".
|
|
697
|
+
One test result, review item or submission row. The status icon carries an accessible name: "Passed", "Failed", "Warning" or "Pending".
|
|
498
698
|
|
|
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 |
|
|
699
|
+
| Prop | Type | Default |
|
|
700
|
+
|---|---|---|
|
|
701
|
+
| `status` **Req.** | `'pass' \| 'fail' \| 'warning' \| 'pending'` | none |
|
|
702
|
+
| `title` **Req.** | `ReactNode` | none |
|
|
703
|
+
| `detail` | `ReactNode`: monospace, keeps line breaks | none |
|
|
704
|
+
| `meta` | `ReactNode`, such as a duration | none |
|
|
705
|
+
| `badge` | `ReactNode`: trailing, such as a category `Badge` | none |
|
|
706
|
+
| `variant` | `'plain' \| 'boxed'` | `'plain'` |
|
|
707
|
+
| `selected` | `boolean`: a cobalt left accent | `false` |
|
|
708
|
+
| `titleMono` | `boolean`: monospace title (test names) | `false` |
|
|
505
709
|
|
|
506
710
|
#### `Message`
|
|
507
711
|
|
|
@@ -520,12 +724,17 @@ A one-line loading, empty or error message. `danger` is announced as an alert, a
|
|
|
520
724
|
| `icon` | `string` | `'inbox'` |
|
|
521
725
|
| `description` | `ReactNode` | none |
|
|
522
726
|
| `action` | `ReactNode` | none |
|
|
727
|
+
| `media` | `ReactNode`: an illustration that replaces the icon | none |
|
|
728
|
+
| `code` | `string`: a large mono numeral such as `"404"`, replacing the icon | none |
|
|
729
|
+
| `tone` | `'default' \| 'danger'` | `'default'` |
|
|
523
730
|
|
|
524
731
|
#### `CheckList`
|
|
525
732
|
|
|
526
733
|
| Prop | Type |
|
|
527
734
|
|---|---|
|
|
528
|
-
| `items` **Req.** | `ReactNode[]`, each rendered with
|
|
735
|
+
| `items` **Req.** | `ReactNode[]`, each rendered with the icon |
|
|
736
|
+
| `icon` | `string` (default `'check'`; use `'close'` for a cons list) |
|
|
737
|
+
| `tone` | `Tone` (default `'success'`) |
|
|
529
738
|
|
|
530
739
|
#### `Card`
|
|
531
740
|
|
|
@@ -534,17 +743,21 @@ A bordered, rounded surface. Polymorphic, default `div`.
|
|
|
534
743
|
| Prop | Type | Default |
|
|
535
744
|
|---|---|---|
|
|
536
745
|
| `padding` | `Responsive<Space>`: the body padding | `'lg'` |
|
|
537
|
-
| `tone` | `'default' \| 'inverse'` (dark obsidian card) | `'default'` |
|
|
746
|
+
| `tone` | `'default' \| 'subtle' \| 'inverse'` (`inverse` is a dark obsidian card that also switches its contents to the dark tokens) | `'default'` |
|
|
747
|
+
| `pattern` | `'none' \| 'dots' \| 'grid'`: background pattern | `'none'` |
|
|
538
748
|
| `interactive` | `boolean`: hover shadow and focus ring, for link cards | `false` |
|
|
539
749
|
|
|
540
750
|
Sub-components:
|
|
541
751
|
|
|
542
|
-
- **`Card.
|
|
752
|
+
- **`Card.Header`** is always rendered first, as a tinted header bar with `start` and `end` slots (or `children` in place of `start`).
|
|
753
|
+
- **`Card.Media`** comes next, edge to edge.
|
|
543
754
|
|
|
544
755
|
| Prop | Type | Default |
|
|
545
756
|
|---|---|---|
|
|
546
757
|
| `pattern` | `'none' \| 'dots' \| 'grid'` | `'dots'` |
|
|
547
758
|
| `aspect` | `'video' \| 'wide' \| 'square'` | `'video'` |
|
|
759
|
+
| `height` | `'sm' \| 'md'` (120px / 140px), instead of `aspect` | none |
|
|
760
|
+
| `caption` | `ReactNode`: a small corner label, e.g. "UML schema" | none |
|
|
548
761
|
| `children` | `ReactNode` (centred overlay) | none |
|
|
549
762
|
|
|
550
763
|
- **`Card.Footer`** is always rendered last as a tinted footer bar. It takes only `children`.
|
|
@@ -560,6 +773,141 @@ All other children go into the padded body, whatever their order in the JSX.
|
|
|
560
773
|
</Card>
|
|
561
774
|
```
|
|
562
775
|
|
|
776
|
+
#### `IconTile`
|
|
777
|
+
|
|
778
|
+
An icon in a tinted square or circle.
|
|
779
|
+
|
|
780
|
+
| Prop | Type | Default |
|
|
781
|
+
|---|---|---|
|
|
782
|
+
| `icon` **Req.** | `string` | none |
|
|
783
|
+
| `tone` | `'neutral' \| 'brand' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` |
|
|
784
|
+
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` (32, 40, 48, 56px) | `'md'` |
|
|
785
|
+
| `shape` | `'square' \| 'circle'` | `'square'` |
|
|
786
|
+
| `filled` | `boolean`: a solid tile with inverted colours | `false` |
|
|
787
|
+
| `label` | `string`: makes it an image with this name (otherwise decorative) | none |
|
|
788
|
+
|
|
789
|
+
#### `Skeleton`
|
|
790
|
+
|
|
791
|
+
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`.
|
|
792
|
+
|
|
793
|
+
| Prop | Type | Default |
|
|
794
|
+
|---|---|---|
|
|
795
|
+
| `shape` | `'line' \| 'pill' \| 'rect' \| 'circle'` | `'line'` |
|
|
796
|
+
| `width` | `'full' \| '3/4' \| '1/2' \| '1/3' \| '1/4'` (ignored for circles) | `'full'` |
|
|
797
|
+
| `height` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | per shape |
|
|
798
|
+
| `lines` | `number`: render that many text lines, the last one shorter | none |
|
|
799
|
+
|
|
800
|
+
```tsx
|
|
801
|
+
<Message>Loading problems…</Message>
|
|
802
|
+
<Skeleton lines={3} />
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
#### `Table`
|
|
806
|
+
|
|
807
|
+
A semantic table inside a focusable horizontal scroller, so wide tables never widen the page.
|
|
808
|
+
|
|
809
|
+
| Prop | Type | Default |
|
|
810
|
+
|---|---|---|
|
|
811
|
+
| `caption` **Req.** | `string`: names the table and its scroll region | none |
|
|
812
|
+
| `columns` **Req.** | `{ key: string; header: ReactNode; align?: 'start' \| 'end'; mono?: boolean; width?: 'auto' \| 'min' }[]` | none |
|
|
813
|
+
| `rows` **Req.** | `Record<string, ReactNode>[]` (keyed by column `key`) | none |
|
|
814
|
+
| `rowKey` | `(row, index) => string` | the index |
|
|
815
|
+
| `showCaption` | `boolean`: show the caption visually (it is always read by screen readers) | `false` |
|
|
816
|
+
| `density` | `'compact' \| 'normal'` | `'normal'` |
|
|
817
|
+
| `empty` | `ReactNode`: shown when `rows` is empty | `'No rows'` |
|
|
818
|
+
|
|
819
|
+
```tsx
|
|
820
|
+
<Table caption="Participants" columns={[{ key: 'name', header: 'Participant', mono: true }, { key: 'role', header: 'Responsibility' }]} rows={participants} />
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
#### `DescriptionList`
|
|
824
|
+
|
|
825
|
+
Term and detail pairs (`<dl>`).
|
|
826
|
+
|
|
827
|
+
| Prop | Type | Default |
|
|
828
|
+
|---|---|---|
|
|
829
|
+
| `items` **Req.** | `{ term: ReactNode; detail: ReactNode }[]` | none |
|
|
830
|
+
| `layout` | `'stacked' \| 'inline'` (`inline` puts term and detail side by side from `sm`) | `'stacked'` |
|
|
831
|
+
| `mono` | `boolean`: monospace details | `false` |
|
|
832
|
+
|
|
833
|
+
#### `Timeline`
|
|
834
|
+
|
|
835
|
+
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"`.
|
|
836
|
+
|
|
837
|
+
| Prop | Type |
|
|
838
|
+
|---|---|
|
|
839
|
+
| `label` **Req.** | `string` |
|
|
840
|
+
| `items` **Req.** | `{ id: string; status: 'done' \| 'current' \| 'locked' \| 'success' \| 'warning' \| 'danger' \| 'pending'; title: ReactNode; badge?: ReactNode; description?: ReactNode; meta?: ReactNode }[]` |
|
|
841
|
+
|
|
842
|
+
```tsx
|
|
843
|
+
<Timeline label="Learning track" items={[{ id: '1', status: 'done', title: 'Parking lot' }, { id: '2', status: 'current', title: 'Elevator' }]} />
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
#### `BarChart`
|
|
847
|
+
|
|
848
|
+
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.
|
|
849
|
+
|
|
850
|
+
| Prop | Type | Default |
|
|
851
|
+
|---|---|---|
|
|
852
|
+
| `label` **Req.** | `string` | none |
|
|
853
|
+
| `bars` **Req.** | `{ value: number; label?: string }[]` | none |
|
|
854
|
+
| `highlight` | `number`: index of the bar to emphasise (others are greyed) | none |
|
|
855
|
+
| `highlightLabel` | `string`: shown above the highlighted bar | none |
|
|
856
|
+
| `axis` | `[ReactNode, ReactNode, ReactNode]`: start, middle and end labels | none |
|
|
857
|
+
| `height` | `'sm' \| 'md'` | `'md'` |
|
|
858
|
+
| `tone` | `'brand' \| 'success'` | `'brand'` |
|
|
859
|
+
|
|
860
|
+
#### `VerdictBanner`
|
|
861
|
+
|
|
862
|
+
A result hero, such as "Accepted". It stacks below `md` and becomes a row from `md`.
|
|
863
|
+
|
|
864
|
+
| Prop | Type |
|
|
865
|
+
|---|---|
|
|
866
|
+
| `tone` **Req.** | `'success' \| 'danger' \| 'warning'` |
|
|
867
|
+
| `icon` **Req.** | `string` |
|
|
868
|
+
| `title` **Req.** | `ReactNode` |
|
|
869
|
+
| `badge` | `ReactNode` |
|
|
870
|
+
| `meta` | `ReactNode[]`: short facts separated by dividers |
|
|
871
|
+
| `actions` | `ReactNode` |
|
|
872
|
+
|
|
873
|
+
```tsx
|
|
874
|
+
<VerdictBanner tone="success" icon="check" title="Accepted" meta={['41ms', '1.4 MB', 'attempt #3']} actions={<Button variant="brand">Next Problem</Button>} />
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
#### `TerminalOutput`
|
|
878
|
+
|
|
879
|
+
A dark, focusable log (`role="log"`) with toned lines. It scrolls inside itself and wraps long lines.
|
|
880
|
+
|
|
881
|
+
| Prop | Type | Default |
|
|
882
|
+
|---|---|---|
|
|
883
|
+
| `lines` **Req.** | `{ kind: 'command' \| 'plain' \| 'error' \| 'warning' \| 'hint' \| 'success'; text: string }[]` | none |
|
|
884
|
+
| `title` | `ReactNode` | none |
|
|
885
|
+
| `status` | `ReactNode`: right side of the header, e.g. a `Badge` | none |
|
|
886
|
+
| `maxHeight` | `'sm' \| 'md' \| 'lg' \| 'none'` | `'md'` |
|
|
887
|
+
|
|
888
|
+
#### `DiffViewer`
|
|
889
|
+
|
|
890
|
+
A line diff of two strings. Added and removed lines are coloured, carry a +/− sign and are announced as "added:" or "removed:".
|
|
891
|
+
|
|
892
|
+
| Prop | Type | Default |
|
|
893
|
+
|---|---|---|
|
|
894
|
+
| `oldValue` **Req.** | `string` | none |
|
|
895
|
+
| `newValue` **Req.** | `string` | none |
|
|
896
|
+
| `oldTitle` / `newTitle` | `ReactNode` | none |
|
|
897
|
+
| `mode` | `'unified' \| 'split'` (`split` falls back to unified below `lg`) | `'unified'` |
|
|
898
|
+
|
|
899
|
+
#### `Overlay`
|
|
900
|
+
|
|
901
|
+
Covers content with a blurred, dimmed layer, for example a signed-out gate. The covered content is `inert` and hidden from assistive tech.
|
|
902
|
+
|
|
903
|
+
| Prop | Type | Default |
|
|
904
|
+
|---|---|---|
|
|
905
|
+
| `children` **Req.** | `ReactNode` (the covered content) | none |
|
|
906
|
+
| `overlay` **Req.** | `ReactNode` (what shows on top) | none |
|
|
907
|
+
| `blur` | `boolean` | `true` |
|
|
908
|
+
|
|
909
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
910
|
+
|
|
563
911
|
### Inputs and interaction
|
|
564
912
|
|
|
565
913
|
#### `Button`
|
|
@@ -573,6 +921,9 @@ Polymorphic, default `button`.
|
|
|
573
921
|
| `size` | `'sm' \| 'md' \| 'lg'` (32, 40, 48px tall) | `'md'` |
|
|
574
922
|
| `icon` | `string`: an icon before the label | none |
|
|
575
923
|
| `iconRight` | `string`: an icon after the label | none |
|
|
924
|
+
| `iconTone` | `Tone`: colour of `icon` | none |
|
|
925
|
+
| `iconFilled` | `boolean`: filled `icon` | `false` |
|
|
926
|
+
| `leading` | `ReactNode`: custom leading content, such as a brand logo; replaces `icon` | none |
|
|
576
927
|
| `fullWidth` | `boolean` | `false` |
|
|
577
928
|
| `loading` | `boolean`: disables the button, shows a spinner and sets `aria-busy` | `false` |
|
|
578
929
|
| `disabled` | `boolean` | `false` |
|
|
@@ -586,14 +937,16 @@ As a native button it defaults to `type="button"`; pass `type="submit"` for form
|
|
|
586
937
|
|
|
587
938
|
#### `IconButton`
|
|
588
939
|
|
|
589
|
-
A square, icon-only button.
|
|
940
|
+
A square, icon-only button. Polymorphic, default `button`, so it can also be a link (`as={Link} href=…`).
|
|
590
941
|
|
|
591
942
|
| Prop | Type | Default |
|
|
592
943
|
|---|---|---|
|
|
593
944
|
| `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'` |
|
|
945
|
+
| `label` **Req.** | `string`: the accessible name and tooltip. Include what `dot`/`badge` mean, e.g. "Notifications, 3 unread" | none |
|
|
946
|
+
| `variant` | `'ghost' \| 'subtle' \| 'secondary' \| 'primary'` | `'ghost'` |
|
|
947
|
+
| `size` | `'xs' \| 'sm' \| 'md'` (24, 32, 40px; at least 44px below `md`) | `'md'` |
|
|
948
|
+
| `dot` | `StatusTone`: a small corner dot | none |
|
|
949
|
+
| `badge` | `ReactNode`: a corner count | none |
|
|
597
950
|
|
|
598
951
|
#### `Kbd`
|
|
599
952
|
|
|
@@ -610,6 +963,9 @@ A labelled text input. All `<input>` props are forwarded, so it works controlled
|
|
|
610
963
|
| `icon` | `string`: a leading icon | none |
|
|
611
964
|
| `hint` | `ReactNode`: trailing content, such as `<Kbd>⌘K</Kbd>` | none |
|
|
612
965
|
| `error` | `string`: sets `aria-invalid` and links the message as the description | none |
|
|
966
|
+
| `labelEnd` | `ReactNode`: at the end of the label row, e.g. a "Forgot password?" `TextLink` | none |
|
|
967
|
+
| `revealable` | `boolean`: a password field with a show/hide toggle | `false` |
|
|
968
|
+
| `size` | `'sm' \| 'md'` (32px / 40px) | `'md'` |
|
|
613
969
|
|
|
614
970
|
```tsx
|
|
615
971
|
<TextField label="Search problems" hideLabel icon="search" hint={<Kbd>⌘K</Kbd>} value={q} onChange={(e) => setQ(e.target.value)} />
|
|
@@ -637,11 +993,13 @@ A tab strip that scrolls horizontally when it doesn't fit.
|
|
|
637
993
|
| `onChange` | `(id: string) => void` | none |
|
|
638
994
|
| `variant` | `'underline' \| 'pills'` | `'underline'` |
|
|
639
995
|
|
|
640
|
-
`TabItem`: `{ id: string; label: ReactNode; count?: number; dot?: StatusTone; href?: string; as?: ElementType }`
|
|
996
|
+
`TabItem`: `{ id: string; label: ReactNode; count?: number; badge?: ReactNode; dot?: StatusTone; href?: string; as?: ElementType; panelId?: string }`
|
|
997
|
+
|
|
998
|
+
`badge` shows a non-numeric count such as `<Badge tone="warning">6/8 Passing</Badge>`.
|
|
641
999
|
|
|
642
1000
|
It has two modes:
|
|
643
1001
|
|
|
644
|
-
- **Tablist** (no item has `href`): an ARIA tablist. Arrow keys, Home and End move between tabs and select them.
|
|
1002
|
+
- **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
1003
|
- **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
1004
|
|
|
647
1005
|
```tsx
|
|
@@ -656,7 +1014,7 @@ A single-choice pill group, such as a language picker. It is an ARIA radio group
|
|
|
656
1014
|
| Prop | Type |
|
|
657
1015
|
|---|---|
|
|
658
1016
|
| `label` **Req.** | `string` |
|
|
659
|
-
| `options` **Req.** | `{ value: string; label: string; icon?: string }[]` |
|
|
1017
|
+
| `options` **Req.** | `{ value: string; label: string; icon?: string; hideLabel?: boolean; dot?: StatusTone }[]` (`hideLabel` shows only the icon; `label` stays the accessible name) |
|
|
660
1018
|
| `value` **Req.** | `string` |
|
|
661
1019
|
| `onChange` **Req.** | `(value: string) => void` |
|
|
662
1020
|
|
|
@@ -676,7 +1034,7 @@ A modal dialog rendered in a portal.
|
|
|
676
1034
|
|
|
677
1035
|
- **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
1036
|
- **Page:** the page behind can't scroll while the dialog is open.
|
|
679
|
-
- **Theme:** the dialog
|
|
1037
|
+
- **Theme:** the dialog uses the tone of the `<Theme>` it is rendered inside, even though it portals to `document.body`.
|
|
680
1038
|
- On small screens it docks to the bottom of the viewport.
|
|
681
1039
|
|
|
682
1040
|
```tsx
|
|
@@ -693,10 +1051,14 @@ A menu button, such as an account menu.
|
|
|
693
1051
|
|---|---|---|
|
|
694
1052
|
| `label` **Req.** | `string`: the menu's accessible name | none |
|
|
695
1053
|
| `trigger` **Req.** | `(props: MenuTriggerProps) => ReactNode`: spread `props` onto a `Button` | none |
|
|
696
|
-
| `items` **Req.** | `MenuItem[]` | none |
|
|
1054
|
+
| `items` **Req.** | `(MenuItem \| { type: 'separator' })[]` | none |
|
|
1055
|
+
| `header` | `ReactNode`: above the items, e.g. the signed-in user | none |
|
|
1056
|
+
| `footer` | `ReactNode`: below the items | none |
|
|
697
1057
|
| `align` | `'start' \| 'end'`: which edge of the trigger the menu aligns to | `'end'` |
|
|
698
1058
|
|
|
699
|
-
`MenuItem`: `{ label: string; icon?: string; onSelect?: () => void; href?: string; as?: ElementType; tone?: 'default' | 'danger' }`
|
|
1059
|
+
`MenuItem`: `{ label: string; icon?: string; onSelect?: () => void; href?: string; as?: ElementType; tone?: 'default' | 'danger'; meta?: ReactNode; shortcut?: string }`
|
|
1060
|
+
|
|
1061
|
+
Separators are skipped by the keyboard.
|
|
700
1062
|
|
|
701
1063
|
Keyboard and pointer behaviour:
|
|
702
1064
|
- Click toggles the menu.
|
|
@@ -712,6 +1074,148 @@ Keyboard and pointer behaviour:
|
|
|
712
1074
|
/>
|
|
713
1075
|
```
|
|
714
1076
|
|
|
1077
|
+
#### `Checkbox`
|
|
1078
|
+
|
|
1079
|
+
A labelled native checkbox. All `<input>` props are forwarded (`checked`, `defaultChecked`, `onChange`…).
|
|
1080
|
+
|
|
1081
|
+
| Prop | Type | Default |
|
|
1082
|
+
|---|---|---|
|
|
1083
|
+
| `label` **Req.** | `ReactNode` | none |
|
|
1084
|
+
| `description` | `ReactNode` | none |
|
|
1085
|
+
| `strikeWhenChecked` | `boolean`: strike the label through when checked (task lists) | `false` |
|
|
1086
|
+
| `indeterminate` | `boolean` | `false` |
|
|
1087
|
+
|
|
1088
|
+
#### `Switch`
|
|
1089
|
+
|
|
1090
|
+
An on/off switch (`role="switch"`).
|
|
1091
|
+
|
|
1092
|
+
| Prop | Type |
|
|
1093
|
+
|---|---|
|
|
1094
|
+
| `label` **Req.** | `string` |
|
|
1095
|
+
| `checked` **Req.** | `boolean` |
|
|
1096
|
+
| `onChange` **Req.** | `(checked: boolean) => void` |
|
|
1097
|
+
| `description` | `ReactNode` |
|
|
1098
|
+
|
|
1099
|
+
#### `Disclosure`
|
|
1100
|
+
|
|
1101
|
+
A button that shows and hides a region, for example an expandable test row.
|
|
1102
|
+
|
|
1103
|
+
| Prop | Type | Default |
|
|
1104
|
+
|---|---|---|
|
|
1105
|
+
| `summary` **Req.** | `ReactNode`: the button content (keep it free of other interactive elements) | none |
|
|
1106
|
+
| `children` **Req.** | `ReactNode` (the revealed content) | none |
|
|
1107
|
+
| `open` / `onOpenChange` | controlled state | none |
|
|
1108
|
+
| `defaultOpen` | `boolean` (uncontrolled) | `false` |
|
|
1109
|
+
| `variant` | `'plain' \| 'row'` | `'plain'` |
|
|
1110
|
+
| `selected` | `boolean`: a cobalt left accent | `false` |
|
|
1111
|
+
|
|
1112
|
+
```tsx
|
|
1113
|
+
<Disclosure variant="row" summary={<ResultRow status="fail" title="TestParkConcurrent" titleMono />}>
|
|
1114
|
+
<TerminalOutput lines={log} />
|
|
1115
|
+
</Disclosure>
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
#### `CopyButton`
|
|
1119
|
+
|
|
1120
|
+
Copies text to the clipboard and confirms for 2 seconds. A failure shows "Copy failed" and never throws.
|
|
1121
|
+
|
|
1122
|
+
| Prop | Type | Default |
|
|
1123
|
+
|---|---|---|
|
|
1124
|
+
| `value` **Req.** | `string` | none |
|
|
1125
|
+
| `label` | `string` | `'Copy'` |
|
|
1126
|
+
| `copiedLabel` | `string` | `'Copied'` |
|
|
1127
|
+
| `size` | `'sm' \| 'md'` | `'sm'` |
|
|
1128
|
+
| `variant` | `ButtonVariant` | `'secondary'` |
|
|
1129
|
+
|
|
1130
|
+
#### `Tooltip`
|
|
1131
|
+
|
|
1132
|
+
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.
|
|
1133
|
+
|
|
1134
|
+
| Prop | Type | Default |
|
|
1135
|
+
|---|---|---|
|
|
1136
|
+
| `content` **Req.** | `ReactNode` | none |
|
|
1137
|
+
| `children` **Req.** | one element (the trigger) | none |
|
|
1138
|
+
| `side` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` |
|
|
1139
|
+
| `delay` | `number` (ms) | `400` |
|
|
1140
|
+
|
|
1141
|
+
```tsx
|
|
1142
|
+
<Tooltip content="Reset zoom to 100%"><IconButton icon="fit_screen" label="Reset zoom" /></Tooltip>
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1146
|
+
|
|
1147
|
+
### Navigation and overlays
|
|
1148
|
+
|
|
1149
|
+
#### `NavList`
|
|
1150
|
+
|
|
1151
|
+
Vertical navigation: an app sidebar or an in-page table of contents. The current item gets `aria-current`.
|
|
1152
|
+
|
|
1153
|
+
| Prop | Type | Default |
|
|
1154
|
+
|---|---|---|
|
|
1155
|
+
| `label` **Req.** | `string` | none |
|
|
1156
|
+
| `items` **Req.** | `{ id: string; label: ReactNode; icon?: string; href?: string; as?: ElementType; count?: ReactNode; onSelect?: () => void }[]` | none |
|
|
1157
|
+
| `current` | `string`: the current item `id` | none |
|
|
1158
|
+
| `heading` | `ReactNode`: a small label above the list | none |
|
|
1159
|
+
| `variant` | `'sidebar' \| 'toc'` | `'sidebar'` |
|
|
1160
|
+
|
|
1161
|
+
```tsx
|
|
1162
|
+
<NavList label="On this page" variant="toc" current="structure" items={[{ id: 'intent', label: '1. Intent', href: '#intent' }, { id: 'structure', label: '2. Structure', href: '#structure' }]} />
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
#### `Pagination`
|
|
1166
|
+
|
|
1167
|
+
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 ›".
|
|
1168
|
+
|
|
1169
|
+
| Prop | Type | Default |
|
|
1170
|
+
|---|---|---|
|
|
1171
|
+
| `page` **Req.** | `number` (1-based) | none |
|
|
1172
|
+
| `pageCount` **Req.** | `number` | none |
|
|
1173
|
+
| `onChange` **Req.** | `(page: number) => void` | none |
|
|
1174
|
+
| `siblingCount` | `number`: pages shown on each side of the current one | `1` |
|
|
1175
|
+
| `summary` | `ReactNode`, e.g. "Showing 12 of 142" | none |
|
|
1176
|
+
| `label` | `string` | `'Pagination'` |
|
|
1177
|
+
|
|
1178
|
+
#### `Drawer`
|
|
1179
|
+
|
|
1180
|
+
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`.
|
|
1181
|
+
|
|
1182
|
+
| Prop | Type | Default |
|
|
1183
|
+
|---|---|---|
|
|
1184
|
+
| `open` **Req.** | `boolean` | none |
|
|
1185
|
+
| `onClose` **Req.** | `() => void` | none |
|
|
1186
|
+
| `title` **Req.** | `ReactNode` | none |
|
|
1187
|
+
| `side` | `'left' \| 'right'` | `'left'` |
|
|
1188
|
+
| `size` | `'sm' \| 'md'` | `'sm'` |
|
|
1189
|
+
| `children` | `ReactNode` | none |
|
|
1190
|
+
|
|
1191
|
+
#### `CommandPalette`
|
|
1192
|
+
|
|
1193
|
+
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.
|
|
1194
|
+
|
|
1195
|
+
| Prop | Type | Default |
|
|
1196
|
+
|---|---|---|
|
|
1197
|
+
| `open` **Req.** | `boolean` | none |
|
|
1198
|
+
| `onClose` **Req.** | `() => void` | none |
|
|
1199
|
+
| `query` **Req.** | `string` | none |
|
|
1200
|
+
| `onQueryChange` **Req.** | `(query: string) => void` | none |
|
|
1201
|
+
| `groups` **Req.** | `{ label: string; items: { id: string; label: ReactNode; icon?: string; meta?: ReactNode; onSelect: () => void }[] }[]` | none |
|
|
1202
|
+
| `placeholder` | `string` | `'Search…'` |
|
|
1203
|
+
| `emptyText` | `ReactNode` | `'No results'` |
|
|
1204
|
+
| `label` | `string` | `'Command palette'` |
|
|
1205
|
+
|
|
1206
|
+
#### `Toaster`
|
|
1207
|
+
|
|
1208
|
+
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.
|
|
1209
|
+
|
|
1210
|
+
`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).
|
|
1211
|
+
|
|
1212
|
+
```tsx
|
|
1213
|
+
const { show } = useToast();
|
|
1214
|
+
show({ title: 'Solution saved', tone: 'success' });
|
|
1215
|
+
```
|
|
1216
|
+
|
|
1217
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1218
|
+
|
|
715
1219
|
### IDE shell
|
|
716
1220
|
|
|
717
1221
|
#### `Workbench`
|
|
@@ -759,7 +1263,9 @@ A keyboard-navigable file tree, built from flat paths.
|
|
|
759
1263
|
| `activePath` | `string`: the selected file | none |
|
|
760
1264
|
| `defaultExpanded` | `string[] \| 'all'` (directory paths) | `'all'` |
|
|
761
1265
|
|
|
762
|
-
`FileNode`: `{ path: string; kind: 'file' | 'dir'; readOnly?: boolean; modified?: boolean }`
|
|
1266
|
+
`FileNode`: `{ path: string; kind: 'file' | 'dir'; readOnly?: boolean; modified?: boolean; icon?: string; status?: 'success' | 'warning' | 'danger' | 'info'; meta?: ReactNode }`
|
|
1267
|
+
|
|
1268
|
+
`icon` overrides the extension icon, `status` adds a named status icon ("Passing", "Failing"…), and `meta` shows trailing text such as a line count.
|
|
763
1269
|
|
|
764
1270
|
- **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
1271
|
- **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 +1314,10 @@ A thin bar at the bottom of the IDE.
|
|
|
808
1314
|
|---|---|---|
|
|
809
1315
|
| `label` **Req.** | `ReactNode` | none |
|
|
810
1316
|
| `value` **Req.** | `ReactNode` | none |
|
|
811
|
-
| `tone` | `'neutral' \| 'success' \| 'danger'` | `'neutral'` |
|
|
1317
|
+
| `tone` | `'neutral' \| 'brand' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` |
|
|
812
1318
|
| `icon` | `string` | none |
|
|
1319
|
+
| `hint` | `ReactNode`: a line under the value, e.g. "Beats 82.4%" | none |
|
|
1320
|
+
| `hintTone` | `Tone` | `'muted'` |
|
|
813
1321
|
|
|
814
1322
|
#### `Avatar`
|
|
815
1323
|
|
|
@@ -819,6 +1327,21 @@ A thin bar at the bottom of the IDE.
|
|
|
819
1327
|
| `src` | `string`: the image. If it's missing or fails to load, initials show instead | none |
|
|
820
1328
|
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
|
|
821
1329
|
| `badge` | `ReactNode`, such as a score, shown at the corner | none |
|
|
1330
|
+
| `shape` | `'circle' \| 'square'` | `'circle'` |
|
|
1331
|
+
| `tone` | `'ink' \| 'brand' \| 'success' \| 'warning' \| 'danger'` (initials background) | `'ink'` |
|
|
1332
|
+
| `status` | `StatusTone`: a presence dot | none |
|
|
1333
|
+
| `statusLabel` | `string`: added to the name, e.g. "online", so the dot isn't colour-only | none |
|
|
1334
|
+
|
|
1335
|
+
#### `AvatarGroup`
|
|
1336
|
+
|
|
1337
|
+
Overlapping avatars, with any beyond `max` collapsed into "+N".
|
|
1338
|
+
|
|
1339
|
+
| Prop | Type | Default |
|
|
1340
|
+
|---|---|---|
|
|
1341
|
+
| `children` **Req.** | `Avatar` elements | none |
|
|
1342
|
+
| `max` | `number` | all |
|
|
1343
|
+
| `size` | `'sm' \| 'md' \| 'lg'` (applied to every avatar) | `'md'` |
|
|
1344
|
+
| `label` | `string`: the group's accessible name | none |
|
|
822
1345
|
|
|
823
1346
|
#### `Countdown`
|
|
824
1347
|
|
|
@@ -835,8 +1358,72 @@ A timer that counts down, or up.
|
|
|
835
1358
|
|
|
836
1359
|
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
1360
|
|
|
1361
|
+
#### `UmlClass`
|
|
1362
|
+
|
|
1363
|
+
A UML class box: name (with an optional «stereotype»), attributes and methods.
|
|
1364
|
+
|
|
1365
|
+
| Prop | Type | Default |
|
|
1366
|
+
|---|---|---|
|
|
1367
|
+
| `name` **Req.** | `string` | none |
|
|
1368
|
+
| `stereotype` | `string`, e.g. `'interface'` | none |
|
|
1369
|
+
| `attributes` | `string[]` | `[]` |
|
|
1370
|
+
| `methods` | `string[]` | `[]` |
|
|
1371
|
+
| `tag` | `ReactNode`: under the name | none |
|
|
1372
|
+
| `emphasis` | `'default' \| 'brand' \| 'strong'` (border weight and colour) | `'default'` |
|
|
1373
|
+
| `size` | `'sm' \| 'md'` | `'md'` |
|
|
1374
|
+
| `dashed` | `boolean` | `false` |
|
|
1375
|
+
|
|
1376
|
+
#### `UmlDiagram`
|
|
1377
|
+
|
|
1378
|
+
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.
|
|
1379
|
+
|
|
1380
|
+
| Prop | Type | Default |
|
|
1381
|
+
|---|---|---|
|
|
1382
|
+
| `label` **Req.** | `string` | none |
|
|
1383
|
+
| `nodes` **Req.** | `{ id: string; name: string; stereotype?; attributes?; methods?; tag?; emphasis?; dashed? }[]` | none |
|
|
1384
|
+
| `edges` **Req.** | `{ from: string; to: string; kind: 'association' \| 'dependency' \| 'realization' \| 'inheritance' \| 'aggregation' \| 'composition'; label?: string; fromMultiplicity?: string; toMultiplicity?: string }[]` | none |
|
|
1385
|
+
| `direction` | `'TB' \| 'LR'` | `'TB'` |
|
|
1386
|
+
| `zoomable` | `boolean`: zoom buttons (50–200%) | `true` |
|
|
1387
|
+
| `compact` | `boolean`: small inline diagram, no zoom controls, scaled to fit the width | `false` |
|
|
1388
|
+
| `pattern` | `'dots' \| 'none'` | `'dots'` |
|
|
1389
|
+
|
|
1390
|
+
- **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.
|
|
1391
|
+
- **Pan:** the diagram scrolls inside itself; focus it and use the arrow keys, or scroll.
|
|
1392
|
+
- **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.
|
|
1393
|
+
|
|
1394
|
+
```tsx
|
|
1395
|
+
<UmlDiagram
|
|
1396
|
+
label="Strategy pattern"
|
|
1397
|
+
nodes={[{ id: 'ctx', name: 'PricingContext' }, { id: 's', name: 'Strategy', stereotype: 'interface' }, { id: 'h', name: 'HourlyStrategy' }]}
|
|
1398
|
+
edges={[{ from: 'ctx', to: 's', kind: 'aggregation' }, { from: 'h', to: 's', kind: 'realization' }]}
|
|
1399
|
+
/>
|
|
1400
|
+
```
|
|
1401
|
+
|
|
838
1402
|
---
|
|
839
1403
|
|
|
1404
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1405
|
+
|
|
1406
|
+
## Mobile navigation
|
|
1407
|
+
|
|
1408
|
+
Every header hides its navigation below a breakpoint and opens a `Drawer` instead. With `Show` this needs no custom CSS:
|
|
1409
|
+
|
|
1410
|
+
```tsx
|
|
1411
|
+
const [open, setOpen] = useState(false);
|
|
1412
|
+
|
|
1413
|
+
<AppBar
|
|
1414
|
+
start={<Logo />}
|
|
1415
|
+
center={<Show above="lg"><Tabs label="Site" value={current} items={navTabs} /></Show>}
|
|
1416
|
+
end={<Show below="lg"><IconButton icon="menu" label="Open menu" onClick={() => setOpen(true)} /></Show>}
|
|
1417
|
+
/>
|
|
1418
|
+
<Drawer open={open} onClose={() => setOpen(false)} title="LLD Lab">
|
|
1419
|
+
<NavList label="Site" items={navItems} current={current} />
|
|
1420
|
+
</Drawer>
|
|
1421
|
+
```
|
|
1422
|
+
|
|
1423
|
+
For sticky side rails under a sticky `AppBar`, use `Split sticky stickyOffset="appbar"`.
|
|
1424
|
+
|
|
1425
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1426
|
+
|
|
840
1427
|
## Design tokens
|
|
841
1428
|
|
|
842
1429
|
`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 +1438,29 @@ It shows `mm:ss`, or `h:mm:ss` from one hour. A deadline already in the past sho
|
|
|
851
1438
|
| Badges | `--color-badge-{beginner,intermediate,amber,advanced}-{bg,text}` |
|
|
852
1439
|
| Spacing | `--spacing-space-{2xs,xs,sm,md,lg,xl,2xl}`, `--spacing-gutter-fluid`, `--spacing-section-{md,lg,xl}` |
|
|
853
1440
|
| Type | `--text-{display,headline-xl,headline-lg,headline-md,headline-sm,body-lead,body-md,body-sm,label-mono,code-inline,button-text}` |
|
|
1441
|
+
| 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 |
|
|
1442
|
+
| Diff | `--color-diff-{add,del}-{bg,fg}` |
|
|
1443
|
+
| App bar | `--spacing-appbar` (4rem, the md `AppBar` height used by `stickyOffset="appbar"`) |
|
|
1444
|
+
| Utilities | `bg-pattern-dots`, `bg-pattern-grid`, `icon-filled`, `skeleton-shimmer` |
|
|
1445
|
+
|
|
1446
|
+
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
1447
|
|
|
855
|
-
|
|
1448
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
856
1449
|
|
|
857
1450
|
## Accessibility
|
|
858
1451
|
|
|
859
1452
|
- **Interactive widgets:** they follow the WAI-ARIA Authoring Practices.
|
|
860
1453
|
- `Tabs` is a tablist, `SegmentedControl` a radio group, and `Menu` a menu button.
|
|
861
1454
|
- `FileTree` is a tree view, and the `Workbench` resize handles are separators with values.
|
|
862
|
-
- `Dialog`
|
|
1455
|
+
- `Dialog`, `Drawer` and `CommandPalette` are modal dialogs; `CommandPalette` uses the combobox pattern.
|
|
1456
|
+
- `Disclosure` is a disclosure button, `Switch` a switch, `Tooltip` a tooltip, and `Timeline` marks the current step.
|
|
863
1457
|
- **Accessible names:** icon-only controls require a `label` (`IconButton`), and status icons have names (`ResultRow`).
|
|
864
1458
|
- **Focus and touch:** focus rings are visible on keyboard focus, and touch targets are at least 44px below `md`.
|
|
865
1459
|
- **Contrast:** status text colours meet WCAG AA in both themes.
|
|
866
1460
|
- **CI checks:** every gallery story runs through axe, and critical or serious violations fail the build.
|
|
867
1461
|
|
|
1462
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1463
|
+
|
|
868
1464
|
## Troubleshooting
|
|
869
1465
|
|
|
870
1466
|
| Symptom | Fix |
|
|
@@ -873,8 +1469,12 @@ Every token under Surfaces, Text, Status text, Borders and Badges changes inside
|
|
|
873
1469
|
| Icons show as words (`play_arrow`) | Load the Material Symbols Outlined stylesheet. |
|
|
874
1470
|
| Wrong fonts | Set `--font-space-grotesk`, `--font-inter` and `--font-jetbrains-mono`, for example on `<html>` through `next/font`'s `variable` option. |
|
|
875
1471
|
| TypeScript error on `className` | This is intentional: use a variant prop, or add a variant to the library. |
|
|
1472
|
+
| Toasts never appear | Mount `<Toaster />` once at the app root. |
|
|
1473
|
+
| `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
1474
|
| `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
1475
|
|
|
1476
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1477
|
+
|
|
878
1478
|
## Development
|
|
879
1479
|
|
|
880
1480
|
```bash
|
|
@@ -895,6 +1495,8 @@ When adding a component:
|
|
|
895
1495
|
2. Keep `className` and `style` out of its props.
|
|
896
1496
|
3. Add a unit test and a story.
|
|
897
1497
|
|
|
1498
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1499
|
+
|
|
898
1500
|
## Releasing
|
|
899
1501
|
|
|
900
1502
|
```bash
|
|
@@ -904,6 +1506,10 @@ git push --follow-tags # the v* tag runs .github/workflows/release.yml
|
|
|
904
1506
|
|
|
905
1507
|
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
1508
|
|
|
1509
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|
|
1510
|
+
|
|
907
1511
|
## License
|
|
908
1512
|
|
|
909
1513
|
MIT
|
|
1514
|
+
|
|
1515
|
+
<sub>[↑ Back to top](#table-of-contents)</sub>
|