#234
DocsNav and TableOfContents
A DocsNav sidebar with two groups and a TableOfContents of four headings rendered side by side.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "DocsNav and TableOfContents" pattern (@codeatlasdev/ui demo #234, docs-kit/docs) in my app.
Call get_demo({ ids: ["#234"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Documentation pages that need a section navigation tree next to an inline outline of the current page.
Keep these library parts, with the props and tokens the demo uses:
- DocsNav, TableOfContents, DocsHeading, DocsNavGroup from "@codeatlasdev/ui"
Behaviour to keep:
- `<DocsNav {groups} pathname="/docs/docs-kit/docs/" onNavigate={() => {}} />`
- `groups` typed `DocsNavGroup[]` has 2 groups: Get started with 2 items and Messages with 4 items
- Messages items carry a `badge`: `badge: 'POST'`, `badge: 'GET'`, `badge: 'PUT'`, `badge: 'DELETE'`
- `<TableOfContents {headings} variant="inline" />`
- `headings` typed `DocsHeading[]` has 4 entries with `id`, `text` and `depth` of 2 or 3
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- DocsNav
@codeatlasdev/ui - TableOfContents
@codeatlasdev/ui
How it is built
- `<DocsNav {groups} pathname="/docs/docs-kit/docs/" onNavigate={() => {}} />`
- `groups` typed `DocsNavGroup[]` has 2 groups: Get started with 2 items and Messages with 4 items
- Messages items carry a `badge`: `badge: 'POST'`, `badge: 'GET'`, `badge: 'PUT'`, `badge: 'DELETE'`
- `<TableOfContents {headings} variant="inline" />`
- `headings` typed `DocsHeading[]` has 4 entries with `id`, `text` and `depth` of 2 or 3
Related
Loading source.