@roadlittledawn/docs-design-system-react 0.8.0 → 0.10.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/USAGE.md ADDED
@@ -0,0 +1,929 @@
1
+ # @roadlittledawn/docs-design-system-react — Component API Reference
2
+
3
+ Hand-maintained reference for all components. Point your AI tool at this file to get full prop coverage without running Storybook.
4
+
5
+ ```
6
+ // CLAUDE.md or equivalent:
7
+ // Component API docs: packages/react/USAGE.md (or https://raw.githubusercontent.com/roadlittledawn/docs-design-system/main/packages/react/USAGE.md)
8
+ ```
9
+
10
+ ---
11
+
12
+ ## Button
13
+
14
+ The Button component provides a consistent way to trigger actions across your documentation.
15
+
16
+ ### Import
17
+
18
+ ```tsx
19
+ import { Button } from '@roadlittledawn/docs-design-system-react';
20
+ ```
21
+
22
+ ### Props
23
+
24
+ Extends `React.ButtonHTMLAttributes<HTMLButtonElement>`.
25
+
26
+ | Prop | Type | Default | Description |
27
+ |------|------|---------|-------------|
28
+ | `variant` | `"primary" \| "secondary" \| "outline"` | `"primary"` | Visual style variant of the button |
29
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Size of the button |
30
+ | `children` | `React.ReactNode` | — | Button content |
31
+ | `disabled` | `boolean` | `false` | Whether the button is disabled (inherited from `ButtonHTMLAttributes`) |
32
+ | `className` | `string` | `""` | Additional CSS classes |
33
+
34
+ ### Examples
35
+
36
+ #### Basic
37
+
38
+ ```tsx
39
+ <Button variant="primary">Primary Button</Button>
40
+ <Button variant="secondary">Secondary Button</Button>
41
+ <Button variant="outline">Outline Button</Button>
42
+ ```
43
+
44
+ #### Sizes
45
+
46
+ ```tsx
47
+ <Button variant="primary" size="sm">Small</Button>
48
+ <Button variant="primary" size="md">Medium</Button>
49
+ <Button variant="primary" size="lg">Large</Button>
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Card
55
+
56
+ The Card component provides a flexible container for displaying content with visual hierarchy.
57
+
58
+ ### Import
59
+
60
+ ```tsx
61
+ import { Card } from '@roadlittledawn/docs-design-system-react';
62
+ ```
63
+
64
+ ### Props
65
+
66
+ | Prop | Type | Default | Description |
67
+ |------|------|---------|-------------|
68
+ | `title` | `string` | — | Optional title displayed at the top of the card |
69
+ | `titleColor` | `"blue" \| "green" \| "purple" \| "red" \| "yellow" \| "gray"` | `"gray"` | Color of the title text |
70
+ | `backgroundColor` | `"blue" \| "green" \| "purple" \| "red" \| "yellow" \| "gray" \| "white"` | `"white"` | Background color of the card |
71
+ | `href` | `string` | — | Optional link URL. When provided, the entire card becomes clickable |
72
+ | `children` | `ReactNode` | — | Card content |
73
+ | `className` | `string` | `""` | Additional CSS classes |
74
+
75
+ ### Examples
76
+
77
+ #### Basic
78
+
79
+ ```tsx
80
+ <Card title="Getting Started">
81
+ Learn the basics of using this documentation system.
82
+ </Card>
83
+ ```
84
+
85
+ #### Clickable card
86
+
87
+ ```tsx
88
+ <Card title="API Reference" href="/docs/api">
89
+ Complete reference for all available components.
90
+ </Card>
91
+ ```
92
+
93
+ #### Colored background
94
+
95
+ ```tsx
96
+ <Card title="New Feature" titleColor="blue" backgroundColor="blue">
97
+ Check out our latest component additions.
98
+ </Card>
99
+ ```
100
+
101
+ ---
102
+
103
+ ## CardGrid
104
+
105
+ The CardGrid component provides a responsive grid layout for displaying multiple cards.
106
+
107
+ ### Import
108
+
109
+ ```tsx
110
+ import { CardGrid } from '@roadlittledawn/docs-design-system-react';
111
+ ```
112
+
113
+ ### Props
114
+
115
+ | Prop | Type | Default | Description |
116
+ |------|------|---------|-------------|
117
+ | `columns` | `2 \| 3 \| 4` | `3` | Number of columns in the grid |
118
+ | `equalHeight` | `boolean` | `true` | When true, all cards in each row expand to the height of the tallest card |
119
+ | `children` | `ReactNode` | — | Grid content (typically Card components) |
120
+ | `className` | `string` | `""` | Additional CSS classes |
121
+
122
+ ### Examples
123
+
124
+ #### Basic
125
+
126
+ ```tsx
127
+ <CardGrid columns={3}>
128
+ <Card title="Tutorials">Step-by-step learning guides.</Card>
129
+ <Card title="How-To Guides">Task-oriented instructions.</Card>
130
+ <Card title="Reference">Technical reference documentation.</Card>
131
+ </CardGrid>
132
+ ```
133
+
134
+ #### With clickable cards
135
+
136
+ ```tsx
137
+ <CardGrid columns={3}>
138
+ <Card title="Documentation" href="/docs">Complete documentation guide</Card>
139
+ <Card title="API Reference" href="/api">Detailed API reference</Card>
140
+ <Card title="Examples" href="/examples">Code examples and patterns</Card>
141
+ </CardGrid>
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Callout
147
+
148
+ The Callout component draws attention to important information within documentation pages.
149
+
150
+ ### Import
151
+
152
+ ```tsx
153
+ import { Callout } from '@roadlittledawn/docs-design-system-react';
154
+ ```
155
+
156
+ ### Props
157
+
158
+ | Prop | Type | Default | Description |
159
+ |------|------|---------|-------------|
160
+ | `variant` | `"caution" \| "important" \| "tip" \| "course"` | — | Visual style variant that sets the color and icon |
161
+ | `title` | `string \| null` | Variant name | Optional title. Pass `null` to hide entirely |
162
+ | `children` | `ReactNode` | — | Callout content |
163
+ | `className` | `string` | `""` | Additional CSS classes |
164
+
165
+ ### Examples
166
+
167
+ #### Caution
168
+
169
+ ```tsx
170
+ <Callout variant="caution">
171
+ This operation cannot be undone. Make sure you have a backup before proceeding.
172
+ </Callout>
173
+ ```
174
+
175
+ #### Important
176
+
177
+ ```tsx
178
+ <Callout variant="important">
179
+ All users must update their passwords by the end of the month.
180
+ </Callout>
181
+ ```
182
+
183
+ #### Tip
184
+
185
+ ```tsx
186
+ <Callout variant="tip">
187
+ You can use keyboard shortcuts (Cmd+K or Ctrl+K) to quickly search the documentation.
188
+ </Callout>
189
+ ```
190
+
191
+ #### Custom title
192
+
193
+ ```tsx
194
+ <Callout variant="important" title="Security Notice">
195
+ Two-factor authentication is now required for all administrator accounts.
196
+ </Callout>
197
+ ```
198
+
199
+ #### No title
200
+
201
+ ```tsx
202
+ <Callout variant="tip" title={null}>
203
+ This callout has no title and displays only the content.
204
+ </Callout>
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Heading
210
+
211
+ The Heading component provides semantic HTML headings (h1–h4) with consistent styling and auto-generated IDs.
212
+
213
+ ### Import
214
+
215
+ ```tsx
216
+ import { Heading } from '@roadlittledawn/docs-design-system-react';
217
+ ```
218
+
219
+ ### Props
220
+
221
+ | Prop | Type | Default | Description |
222
+ |------|------|---------|-------------|
223
+ | `level` | `1 \| 2 \| 3 \| 4` | — | Heading level — renders as `<h1>` through `<h4>` |
224
+ | `id` | `string` | auto-generated from text | Override the auto-generated `id` attribute |
225
+ | `children` | `React.ReactNode` | — | Heading content |
226
+ | `className` | `string` | `""` | Additional CSS classes |
227
+
228
+ ### Examples
229
+
230
+ #### Basic
231
+
232
+ ```tsx
233
+ <Heading level={1}>Page Title</Heading>
234
+ <Heading level={2}>Section Title</Heading>
235
+ <Heading level={3}>Subsection Title</Heading>
236
+ <Heading level={4}>Sub-subsection Title</Heading>
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Typography
242
+
243
+ The Typography component renders text with predefined styles for consistency.
244
+
245
+ ### Import
246
+
247
+ ```tsx
248
+ import { Typography } from '@roadlittledawn/docs-design-system-react';
249
+ ```
250
+
251
+ ### Props
252
+
253
+ | Prop | Type | Default | Description |
254
+ |------|------|---------|-------------|
255
+ | `variant` | `"h1" \| "h2" \| "h3" \| "h4" \| "p" \| "caption"` | `"p"` | Typography style variant. `h1`–`h4` render as heading elements; `p` and `caption` render as `<p>` |
256
+ | `children` | `React.ReactNode` | — | Text content |
257
+ | `className` | `string` | `""` | Additional CSS classes |
258
+
259
+ ### Examples
260
+
261
+ #### Basic
262
+
263
+ ```tsx
264
+ <Typography variant="h1">Heading 1 Style</Typography>
265
+ <Typography variant="p">
266
+ This is a paragraph with the default typography style.
267
+ </Typography>
268
+ <Typography variant="caption">
269
+ This is caption text, typically used for figure captions.
270
+ </Typography>
271
+ ```
272
+
273
+ ---
274
+
275
+ ## Link
276
+
277
+ The Link component provides consistent link styling and automatically handles external links.
278
+
279
+ ### Import
280
+
281
+ ```tsx
282
+ import { Link } from '@roadlittledawn/docs-design-system-react';
283
+ ```
284
+
285
+ ### Props
286
+
287
+ | Prop | Type | Default | Description |
288
+ |------|------|---------|-------------|
289
+ | `href` | `string` | — | URL to link to. External links (starting with `http://` or `https://`) open in a new tab with an external link icon |
290
+ | `children` | `React.ReactNode` | — | Link content (optional in types, but required for accessible usage) |
291
+ | `className` | `string` | `""` | Additional CSS classes |
292
+
293
+ ### Examples
294
+
295
+ #### Internal link
296
+
297
+ ```tsx
298
+ <Link href="/docs/components">View Components Documentation</Link>
299
+ ```
300
+
301
+ #### External link (opens in new tab)
302
+
303
+ ```tsx
304
+ <Link href="https://github.com/roadlittledawn/docs-design-system">View on GitHub</Link>
305
+ ```
306
+
307
+ ---
308
+
309
+ ## List
310
+
311
+ A visually enhanced list component with numbered badges (ordered) or custom bullets (unordered) and connector lines.
312
+
313
+ ### Import
314
+
315
+ ```tsx
316
+ import { List } from '@roadlittledawn/docs-design-system-react';
317
+ ```
318
+
319
+ ### List Props
320
+
321
+ | Prop | Type | Default | Description |
322
+ |------|------|---------|-------------|
323
+ | `children` | `ReactNode` | — | `List.Item` components to render |
324
+ | `className` | `string` | `""` | Additional CSS classes |
325
+ | `ordered` | `boolean` | `true` | Whether the list is ordered (numbered) or unordered (bullets) |
326
+ | `bullet` | `string` | — | Custom bullet character for unordered lists (e.g. `"✅"`). Only applies when `ordered` is false |
327
+ | `bulletIcon` | `ReactNode` | — | Custom bullet icon (React node). Takes precedence over `bullet`. Only applies when `ordered` is false |
328
+
329
+ ### List.Item Props
330
+
331
+ | Prop | Type | Default | Description |
332
+ |------|------|---------|-------------|
333
+ | `children` | `ReactNode` | — | List item content |
334
+ | `className` | `string` | `""` | Additional CSS classes |
335
+
336
+ ### Examples
337
+
338
+ #### Ordered list
339
+
340
+ ```tsx
341
+ <List>
342
+ <List.Item>Run the following command: <code>npm install</code></List.Item>
343
+ <List.Item>Configure your project settings.</List.Item>
344
+ <List.Item>Start the development server.</List.Item>
345
+ </List>
346
+ ```
347
+
348
+ #### Unordered list with emoji bullet
349
+
350
+ ```tsx
351
+ <List ordered={false} bullet="✅">
352
+ <List.Item>Beautifully designed components</List.Item>
353
+ <List.Item>Accessible by default</List.Item>
354
+ <List.Item>Fully customizable styling</List.Item>
355
+ </List>
356
+ ```
357
+
358
+ #### Unordered list with custom icon
359
+
360
+ ```tsx
361
+ <List
362
+ ordered={false}
363
+ bulletIcon={
364
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
365
+ <path d="M5 12h14M12 5l7 7-7 7" />
366
+ </svg>
367
+ }
368
+ >
369
+ <List.Item>Navigate to the settings page</List.Item>
370
+ <List.Item>Select your preferences</List.Item>
371
+ <List.Item>Save your changes</List.Item>
372
+ </List>
373
+ ```
374
+
375
+ ---
376
+
377
+ ## CodeBlock
378
+
379
+ The CodeBlock component provides syntax highlighting, copy functionality, and support for multiple tabs and languages.
380
+
381
+ ### Import
382
+
383
+ ```tsx
384
+ import { CodeBlock } from '@roadlittledawn/docs-design-system-react';
385
+ ```
386
+
387
+ ### CodeBlock Props
388
+
389
+ | Prop | Type | Default | Description |
390
+ |------|------|---------|-------------|
391
+ | `code` | `string` | — | Single code snippet string. Use `snippets` for multi-tab or multi-language layouts |
392
+ | `language` | `string` | — | Language for syntax highlighting (e.g. `"typescript"`, `"bash"`, `"python"`) |
393
+ | `filename` | `string` | — | Optional filename label shown in the header when there is only one snippet |
394
+ | `highlightLines` | `number[]` | — | Array of 1-indexed line numbers to highlight |
395
+ | `snippets` | `CodeSnippet[]` | — | Array of code snippets for multi-tab or multi-language display. Takes precedence over `code` |
396
+ | `path` | `string` | — | URL or path to a markdown file containing fenced code blocks to load as snippets |
397
+ | `className` | `string` | `""` | Additional CSS classes applied to the outer container |
398
+
399
+ ### CodeSnippet Type
400
+
401
+ | Prop | Type | Default | Description |
402
+ |------|------|---------|-------------|
403
+ | `code` | `string` | — | The code content |
404
+ | `language` | `string` | — | Language for syntax highlighting |
405
+ | `filename` | `string` | — | Optional filename to display |
406
+ | `tabTitle` | `string` | — | Optional tab title (defaults to filename if not provided) |
407
+ | `highlightLines` | `number[]` | — | Optional line numbers to highlight (1-indexed) |
408
+
409
+ ### Supported languages (bundled)
410
+
411
+ JavaScript, TypeScript, JSX, TSX, CSS, Markdown, JSON, Bash, Ruby, Python, Java, SQL, YAML, PHP.
412
+
413
+ For additional languages, use `registerLanguages`:
414
+
415
+ ```ts
416
+ import { registerLanguages } from '@roadlittledawn/docs-design-system-react';
417
+
418
+ await registerLanguages(async () => {
419
+ await import('prismjs/components/prism-go');
420
+ await import('prismjs/components/prism-rust');
421
+ });
422
+ ```
423
+
424
+ ### Examples
425
+
426
+ #### Basic
427
+
428
+ ```tsx
429
+ <CodeBlock
430
+ language="typescript"
431
+ code={`function greet(name: string) {
432
+ return \`Hello, \${name}!\`;
433
+ }`}
434
+ />
435
+ ```
436
+
437
+ #### With filename
438
+
439
+ ```tsx
440
+ <CodeBlock
441
+ language="bash"
442
+ filename="setup.sh"
443
+ code={`npm install\nnpm run build`}
444
+ />
445
+ ```
446
+
447
+ #### With highlighted lines
448
+
449
+ ```tsx
450
+ <CodeBlock
451
+ language="javascript"
452
+ highlightLines={[2, 3, 4]}
453
+ code={`function calculateTotal(items) {
454
+ let total = 0;
455
+ for (const item of items) {
456
+ total += item.price * item.quantity;
457
+ }
458
+ return total;
459
+ }`}
460
+ />
461
+ ```
462
+
463
+ #### Multiple tabs
464
+
465
+ ```tsx
466
+ <CodeBlock
467
+ snippets={[
468
+ { code: `export const Button = () => <button>Click</button>;`, language: 'jsx', tabTitle: 'Button.jsx' },
469
+ { code: `.button { padding: 0.5rem 1rem; }`, language: 'css', tabTitle: 'Button.css' },
470
+ ]}
471
+ />
472
+ ```
473
+
474
+ ---
475
+
476
+ ## Tabs
477
+
478
+ Tabs organize and segment related content, reducing cognitive load by allowing users to toggle between views.
479
+
480
+ ### Import
481
+
482
+ ```tsx
483
+ import { Tabs, TabList, Tab, TabPanel } from '@roadlittledawn/docs-design-system-react';
484
+ ```
485
+
486
+ ### Tabs Props
487
+
488
+ | Prop | Type | Default | Description |
489
+ |------|------|---------|-------------|
490
+ | `defaultActiveTab` | `string` | — | ID of the tab that is active by default (uncontrolled mode) |
491
+ | `activeTab` | `string` | — | Controlled active tab ID. Use with `onTabChange` to manage state externally |
492
+ | `onTabChange` | `(id: string) => void` | — | Callback fired when the active tab changes |
493
+ | `children` | `React.ReactNode` | — | Tab content — typically `TabList` and `TabPanel` components |
494
+ | `className` | `string` | `""` | Additional CSS classes applied to the outer container |
495
+
496
+ ### Tab Props
497
+
498
+ | Prop | Type | Default | Description |
499
+ |------|------|---------|-------------|
500
+ | `id` | `string` | — | Unique identifier for this tab |
501
+ | `children` | `React.ReactNode` | — | Tab label |
502
+ | `className` | `string` | `""` | Additional CSS classes |
503
+
504
+ ### TabPanel Props
505
+
506
+ | Prop | Type | Default | Description |
507
+ |------|------|---------|-------------|
508
+ | `id` | `string` | — | ID matching the corresponding Tab |
509
+ | `children` | `React.ReactNode` | — | Panel content |
510
+ | `className` | `string` | `""` | Additional CSS classes |
511
+
512
+ ### Examples
513
+
514
+ #### Basic
515
+
516
+ ```tsx
517
+ <Tabs defaultActiveTab="overview">
518
+ <TabList>
519
+ <Tab id="overview">Overview</Tab>
520
+ <Tab id="usage">Usage</Tab>
521
+ <Tab id="api">API Reference</Tab>
522
+ </TabList>
523
+ <TabPanel id="overview">
524
+ <p>This is the overview section.</p>
525
+ </TabPanel>
526
+ <TabPanel id="usage">
527
+ <p>This is the usage section.</p>
528
+ </TabPanel>
529
+ <TabPanel id="api">
530
+ <p>This is the API reference section.</p>
531
+ </TabPanel>
532
+ </Tabs>
533
+ ```
534
+
535
+ #### Code examples in different languages
536
+
537
+ ```tsx
538
+ <Tabs defaultActiveTab="javascript">
539
+ <TabList>
540
+ <Tab id="javascript">JavaScript</Tab>
541
+ <Tab id="python">Python</Tab>
542
+ </TabList>
543
+ <TabPanel id="javascript">
544
+ <CodeBlock language="javascript" code={`const greeting = "Hello, world!";\nconsole.log(greeting);`} />
545
+ </TabPanel>
546
+ <TabPanel id="python">
547
+ <CodeBlock language="python" code={`greeting = "Hello, world!"\nprint(greeting)`} />
548
+ </TabPanel>
549
+ </Tabs>
550
+ ```
551
+
552
+ ---
553
+
554
+ ## Collapser
555
+
556
+ The Collapser component allows users to show and hide content sections to reduce visual clutter.
557
+
558
+ ### Import
559
+
560
+ ```tsx
561
+ import { Collapser } from '@roadlittledawn/docs-design-system-react';
562
+ ```
563
+
564
+ ### Props
565
+
566
+ | Prop | Type | Default | Description |
567
+ |------|------|---------|-------------|
568
+ | `title` | `string \| ReactNode` | — | Title text or element displayed in the collapsible header |
569
+ | `id` | `string` | — | Optional ID for the title element (useful for anchor links) |
570
+ | `defaultOpen` | `boolean` | `false` | Whether the collapser should be open by default (uncontrolled) |
571
+ | `open` | `boolean` | — | Controlled open state (used by CollapserGroup) |
572
+ | `onToggle` | `() => void` | — | Callback when toggle is clicked (used by CollapserGroup) |
573
+ | `children` | `ReactNode` | — | Content to show/hide when toggling |
574
+ | `className` | `string` | `""` | Additional CSS classes |
575
+ | `align` | `"left" \| "right"` | `"left"` | Alignment of the title within the header |
576
+ | `icon` | `ReactNode` | — | Optional icon rendered on the left side of the header, before the title |
577
+ | `stepNumber` | `number` | — | Numeric step label shown on the far left. Auto-injected by `CollapserGroup` when `numbered` is true |
578
+
579
+ ### Examples
580
+
581
+ #### Basic
582
+
583
+ ```tsx
584
+ <Collapser title="Click to expand">
585
+ <p>This content is hidden by default.</p>
586
+ </Collapser>
587
+ ```
588
+
589
+ #### Open by default
590
+
591
+ ```tsx
592
+ <Collapser title="This section starts open" defaultOpen>
593
+ <p>This collapser is open by default.</p>
594
+ </Collapser>
595
+ ```
596
+
597
+ #### With icon and right-aligned title
598
+
599
+ ```tsx
600
+ <Collapser title="Quick start guide" align="right" icon={<YourIcon />}>
601
+ <p>Content here.</p>
602
+ </Collapser>
603
+ ```
604
+
605
+ ---
606
+
607
+ ## CollapserGroup
608
+
609
+ CollapserGroup provides a container for multiple Collapser components with built-in spacing and optional accordion behavior.
610
+
611
+ ### Import
612
+
613
+ ```tsx
614
+ import { CollapserGroup, Collapser } from '@roadlittledawn/docs-design-system-react';
615
+ ```
616
+
617
+ ### Props
618
+
619
+ | Prop | Type | Default | Description |
620
+ |------|------|---------|-------------|
621
+ | `children` | `React.ReactNode` | — | Collapser components to render inside the group |
622
+ | `spacing` | `string` | `"0.5rem"` | CSS gap value between collapser items |
623
+ | `allowMultiple` | `boolean` | `true` | Allow multiple collapsers to be open simultaneously. When false, opening one closes the others (accordion mode) |
624
+ | `defaultOpen` | `number \| number[]` | — | Index or array of indexes of collapsers that should be open by default |
625
+ | `onChange` | `(openIndexes: number[]) => void` | — | Callback fired when the open state changes |
626
+ | `className` | `string` | `""` | Additional CSS classes |
627
+ | `numbered` | `boolean` | `false` | Automatically prefix each collapser header with a sequential step number (1, 2, 3…) |
628
+
629
+ ### Examples
630
+
631
+ #### FAQ (accordion mode)
632
+
633
+ ```tsx
634
+ <CollapserGroup allowMultiple={false}>
635
+ <Collapser title="What is this documentation system?">
636
+ <p>A comprehensive design system for documentation sites.</p>
637
+ </Collapser>
638
+ <Collapser title="How do I get started?">
639
+ <p>Install the package and explore the components.</p>
640
+ </Collapser>
641
+ </CollapserGroup>
642
+ ```
643
+
644
+ #### Numbered steps with icons
645
+
646
+ ```tsx
647
+ <CollapserGroup numbered>
648
+ <Collapser title="Install dependencies" align="right" icon={<YourIcon />}>
649
+ <p>Run <code>npm install</code>.</p>
650
+ </Collapser>
651
+ <Collapser title="Configure your project" align="right" icon={<YourIcon />}>
652
+ <p>Update configuration files.</p>
653
+ </Collapser>
654
+ </CollapserGroup>
655
+ ```
656
+
657
+ ---
658
+
659
+ ## Popover
660
+
661
+ A hover/tap-activated popover for enriching inline content in documentation. Built on the native Popover API for reliable top-layer rendering.
662
+
663
+ ### Import
664
+
665
+ ```tsx
666
+ import { Popover } from '@roadlittledawn/docs-design-system-react';
667
+ ```
668
+
669
+ ### Popover Props
670
+
671
+ | Prop | Type | Default | Description |
672
+ |------|------|---------|-------------|
673
+ | `content` | `ReactNode` | — | Arbitrary React content inside the popover. Use when built-in templates don't fit |
674
+ | `glossary` | `GlossaryData` | — | Renders a styled glossary definition popover |
675
+ | `preview` | `PreviewData` | — | Renders a Wikipedia-style content preview |
676
+ | `placement` | `"auto" \| "top" \| "top-start" \| "top-end" \| "bottom" \| "bottom-start" \| "bottom-end"` | `"auto"` | Preferred placement relative to the trigger |
677
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Popover width — `sm`=240px, `md`=320px, `lg`=480px |
678
+ | `showDelay` | `number` | `200` | Milliseconds to wait before showing the popover on hover |
679
+ | `hideDelay` | `number` | `150` | Milliseconds to wait before hiding the popover on hover-out |
680
+ | `children` | `ReactNode` | — | The trigger element — the text or content that reveals the popover on hover/tap |
681
+ | `className` | `string` | `""` | Additional CSS classes on the trigger wrapper |
682
+
683
+ ### GlossaryData Type
684
+
685
+ | Prop | Type | Description |
686
+ |------|------|-------------|
687
+ | `term` | `string` | The canonical term (used for semantic markup) |
688
+ | `title` | `string` | Display title shown in the popover header |
689
+ | `definition` | `ReactNode` | Definition content. Accepts ReactNode so you can pre-render markdown |
690
+
691
+ ### PreviewData Type
692
+
693
+ | Prop | Type | Default | Description |
694
+ |------|------|---------|-------------|
695
+ | `title` | `string` | — | Page or article title |
696
+ | `excerpt` | `ReactNode` | — | Short excerpt or summary |
697
+ | `imageUrl` | `string` | — | Optional featured image URL |
698
+ | `href` | `string` | — | Optional URL to the full content |
699
+ | `linkText` | `string` | `"Read more"` | Link text |
700
+
701
+ ### Examples
702
+
703
+ #### Glossary definition
704
+
705
+ ```tsx
706
+ <p>
707
+ Modern software relies on{' '}
708
+ <Popover
709
+ glossary={{
710
+ term: "observability",
711
+ title: "Observability",
712
+ definition: "The ability to understand the internal state of a system by examining its external outputs.",
713
+ }}
714
+ >
715
+ observability
716
+ </Popover>
717
+ {' '}to diagnose issues quickly.
718
+ </p>
719
+ ```
720
+
721
+ #### Content preview
722
+
723
+ ```tsx
724
+ <Popover
725
+ size="lg"
726
+ preview={{
727
+ title: "New Relic",
728
+ excerpt: "New Relic is an observability platform.",
729
+ href: "https://newrelic.com",
730
+ linkText: "Read more",
731
+ }}
732
+ >
733
+ New Relic
734
+ </Popover>
735
+ ```
736
+
737
+ #### Custom content
738
+
739
+ ```tsx
740
+ <Popover content={<div style={{ padding: '1rem' }}>Custom content here</div>}>
741
+ hover me
742
+ </Popover>
743
+ ```
744
+
745
+ ---
746
+
747
+ ## Grid and Column
748
+
749
+ Layout primitive for multi-column documentation content. Supports equal and fractional column splits, configurable responsive stacking, optional column dividers, borders, and background colors.
750
+
751
+ ### Import
752
+
753
+ ```tsx
754
+ import { Grid, Column } from '@roadlittledawn/docs-design-system-react';
755
+ ```
756
+
757
+ ### Grid Props
758
+
759
+ | Prop | Type | Default | Description |
760
+ |------|------|---------|-------------|
761
+ | `columns` | `number \| number[]` | `2` | Number of equal columns, or an array of fractional widths (e.g. `[1, 2]` for 1/3 + 2/3) |
762
+ | `gap` | `string` | `"md"` | Space between columns. Use `"sm"`, `"md"`, or `"lg"` for design tokens, or any CSS length (e.g. `"16px"`) |
763
+ | `stackAt` | `"sm" \| "md" \| "lg" \| "never"` | `"md"` | Breakpoint at which columns collapse to a single vertical stack |
764
+ | `columnDivider` | `BorderConfig` | — | Vertical dividing line between columns |
765
+ | `topBorder` | `BorderConfig` | — | Horizontal rule rendered above the grid |
766
+ | `bottomBorder` | `BorderConfig` | — | Horizontal rule rendered below the grid |
767
+ | `align` | `"start" \| "center" \| "end" \| "stretch"` | `"stretch"` | Vertical alignment of content within each column |
768
+ | `backgroundColor` | `string` | — | Background color applied to the grid container |
769
+ | `className` | `string` | `""` | Additional CSS classes |
770
+ | `children` | `ReactNode` | — | Grid content — typically `Column` components |
771
+
772
+ ### Column Props
773
+
774
+ | Prop | Type | Default | Description |
775
+ |------|------|---------|-------------|
776
+ | `span` | `number` | `1` | How many grid columns this item should span |
777
+ | `sticky` | `boolean` | `false` | Makes the column sticky while adjacent columns scroll. Useful for tutorial-style layouts with a persistent code panel |
778
+ | `backgroundColor` | `string` | — | Background color applied to the column |
779
+ | `className` | `string` | `""` | Additional CSS classes |
780
+ | `children` | `ReactNode` | — | Column content |
781
+
782
+ ### BorderConfig Type
783
+
784
+ | Prop | Type | Default | Description |
785
+ |------|------|---------|-------------|
786
+ | `thickness` | `number` | `1` | Line thickness in pixels |
787
+ | `color` | `string` | — | Line color (defaults to the `--dds-grid-divider-color` token) |
788
+
789
+ ### Examples
790
+
791
+ #### Two equal columns
792
+
793
+ ```tsx
794
+ <Grid columns={2}>
795
+ <Column>Column 1 content</Column>
796
+ <Column>Column 2 content</Column>
797
+ </Grid>
798
+ ```
799
+
800
+ #### Asymmetric 1/3 + 2/3 split
801
+
802
+ ```tsx
803
+ <Grid columns={[1, 2]}>
804
+ <Column>Narrow (1/3)</Column>
805
+ <Column>Wide (2/3)</Column>
806
+ </Grid>
807
+ ```
808
+
809
+ #### Tutorial with sticky code panel
810
+
811
+ ```tsx
812
+ <Grid columns={2} stackAt="lg" gap="lg" columnDivider={{ thickness: 2 }}>
813
+ <Column>
814
+ <p><strong>Step 1 — Install dependencies</strong></p>
815
+ <p>Run the installer and follow the prompts.</p>
816
+ </Column>
817
+ <Column sticky>
818
+ <CodeBlock language="bash" code="npm install" />
819
+ </Column>
820
+ </Grid>
821
+ ```
822
+
823
+ ---
824
+
825
+ ## Table
826
+
827
+ Table displays structured, relational data in rows and columns. Supports sortable columns, sticky header, borderless variant, and responsive horizontal scrolling.
828
+
829
+ ### Import
830
+
831
+ ```tsx
832
+ import {
833
+ Table,
834
+ TableHead,
835
+ TableBody,
836
+ TableRow,
837
+ TableHeaderCell,
838
+ TableCell,
839
+ } from '@roadlittledawn/docs-design-system-react';
840
+ ```
841
+
842
+ ### Table Props
843
+
844
+ | Prop | Type | Default | Description |
845
+ |------|------|---------|-------------|
846
+ | `children` | `React.ReactNode` | — | Typically `TableHead` and `TableBody` |
847
+ | `variant` | `"default" \| "borderless"` | `"default"` | `"default"` renders all borders; `"borderless"` shows only row top/bottom borders |
848
+ | `stickyHeader` | `boolean` | `false` | When true, the header row sticks to the top of the scroll container while scrolling. Pair with `style={{ maxHeight: '...' }}` |
849
+ | `headerBg` | `string` | — | Background color applied to the header row. Accepts any valid CSS color value |
850
+ | `onSort` | `(key: string, direction: "asc" \| "desc" \| null) => void` | — | Callback fired when a sortable column header is clicked. Useful for server-side sorting |
851
+ | `className` | `string` | `""` | Additional CSS classes |
852
+ | `style` | `React.CSSProperties` | — | Inline styles. Use `maxHeight` here with `stickyHeader` |
853
+
854
+ ### TableHeaderCell Props
855
+
856
+ | Prop | Type | Default | Description |
857
+ |------|------|---------|-------------|
858
+ | `children` | `React.ReactNode` | — | Cell content / column label |
859
+ | `sortKey` | `string` | — | Unique key for this column. When provided the column becomes sortable |
860
+ | `align` | `"left" \| "center" \| "right"` | `"left"` | Text alignment |
861
+ | `className` | `string` | `""` | Additional CSS classes |
862
+
863
+ ### TableCell Props
864
+
865
+ | Prop | Type | Default | Description |
866
+ |------|------|---------|-------------|
867
+ | `children` | `React.ReactNode` | — | Cell content |
868
+ | `align` | `"left" \| "center" \| "right"` | `"left"` | Text alignment |
869
+ | `className` | `string` | `""` | Additional CSS classes |
870
+
871
+ ### Examples
872
+
873
+ #### Basic table
874
+
875
+ ```tsx
876
+ <Table>
877
+ <TableHead>
878
+ <TableRow>
879
+ <TableHeaderCell>Name</TableHeaderCell>
880
+ <TableHeaderCell>Role</TableHeaderCell>
881
+ <TableHeaderCell>Status</TableHeaderCell>
882
+ </TableRow>
883
+ </TableHead>
884
+ <TableBody>
885
+ <TableRow>
886
+ <TableCell>Alice Johnson</TableCell>
887
+ <TableCell>Engineer</TableCell>
888
+ <TableCell>Active</TableCell>
889
+ </TableRow>
890
+ </TableBody>
891
+ </Table>
892
+ ```
893
+
894
+ #### Borderless with sorting
895
+
896
+ ```tsx
897
+ <Table variant="borderless" onSort={(key, direction) => { /* sort your data */ }}>
898
+ <TableHead>
899
+ <TableRow>
900
+ <TableHeaderCell sortKey="name">Name</TableHeaderCell>
901
+ <TableHeaderCell sortKey="role">Role</TableHeaderCell>
902
+ </TableRow>
903
+ </TableHead>
904
+ <TableBody>
905
+ {rows.map((row) => (
906
+ <TableRow key={row.name}>
907
+ <TableCell>{row.name}</TableCell>
908
+ <TableCell>{row.role}</TableCell>
909
+ </TableRow>
910
+ ))}
911
+ </TableBody>
912
+ </Table>
913
+ ```
914
+
915
+ #### Sticky header
916
+
917
+ ```tsx
918
+ <Table stickyHeader style={{ maxHeight: '300px' }}>
919
+ <TableHead>
920
+ <TableRow>
921
+ <TableHeaderCell>Name</TableHeaderCell>
922
+ <TableHeaderCell>Department</TableHeaderCell>
923
+ </TableRow>
924
+ </TableHead>
925
+ <TableBody>
926
+ {/* many rows */}
927
+ </TableBody>
928
+ </Table>
929
+ ```