Documentation Guidelines
How to structure docs, examples, and sidebar entries for Niko Table and Data Grid.
Follow this when adding or restructuring docs. The site is Astro Starlight; demos come from registry example files under src/registry/new-york/examples/.
Information architecture
Section titled “Information architecture”Split API / overview from runnable examples. Do not put the same topic in both sidebars.
| Section | Purpose | Path |
|---|---|---|
| Niko Table | Introduction + overview by layer (Components, Core, …) | src/content/docs/niko-table/ |
| Examples | Table demos (Simple Table, Faceted Filter, …) | src/content/docs/examples/ |
| Data Grid | Introduction + overview by layer + API Reference | src/content/docs/data-grid/ |
| Data Grid Examples | Grid demos (Basic Grid, Cell Types, Validation, …) | src/content/docs/examples/ |
Data Grid overview pages mirror the source tree (grid/components, grid/core, grid/hooks, …). Feature walkthroughs with a live demo belong under Data Grid Examples, not under overview.
Reference: Basic Grid: minimal grid example that follows this guide.
File layout
Section titled “File layout”src/content/docs/ niko-table/overview/ # table API by layer data-grid/ introduction.mdx api.mdx overview/ # grid API by layer examples/ simple-table.mdx # table example basic-grid.mdx # grid example (*-grid.mdx)src/registry/new-york/examples/niko-table/ simple.tsx # demo wired by CodePreview grid-basic.tsx grid-basic-state.tsx # optional collapsible “state” pane- Table example slugs:
examples/<feature>-table(or existing names likesimple-table). - Grid example slugs:
examples/<feature>-grid. - Overview never duplicates an example’s full tutorial; link across instead.
Adding a Data Grid Example
Section titled “Adding a Data Grid Example”-
Registry demo: add a self-contained example under
src/registry/new-york/examples/niko-table/(e.g.grid-foo.tsx). Import only from@/components/niko-table/...direct paths and@/components/ui. Use deterministic mock data (noMath.random()/Date.now()). -
Register the demo name: add the string to the
Demounion insrc/components/markdown/code-preview/_code-preview-internal.tsx, and wire the lazy import map there. -
Example MDX: create
src/content/docs/examples/<name>-grid.mdxwith:- Short pitch (1–2 sentences)
<CodePreview demo="niko-table/…" />- Optional
<CollapsiblePreview>+ state demo - Installation (
CliCommandCode) - Optional short “What’s included” / usage notes
- Next links to related overview or examples
-
Sidebar: add an entry under Data Grid Examples in
astro.config.mts(slug: "examples/<name>-grid"). The slug must match a file atsrc/content/docs/<slug>.mdxorsrc/content/docs/<slug>/index.mdx. A missing file throws Starlight’sThe slug "…" specified in the Starlight sidebar config does not existerror (clear.astro/and restartpnpm devif the file exists but the error persists). -
Cross-links: from Introduction / overview pages, link to the example; don’t paste a second live demo of the same feature into overview.
Page patterns
Section titled “Page patterns”Overview (API by layer)
Section titled “Overview (API by layer)”- Source Code / related DocsLink row at the top when useful
- Props tables and import paths by file
- Point to examples for “see it running”
Example (demo-first)
Section titled “Example (demo-first)”- Demo first, prose after
- Installation for that example’s registry items only
- Keep deeper theory in overview; keep the example focused
Prefer trailing slashes in hardcoded hrefs and markdown links, e.g. /examples/basic-grid/. Dev can accept both with trailingSlash: "ignore", but slashed links stay consistent with production directory URLs.
Punctuation
Section titled “Punctuation”Avoid em dashes (—). Prefer a colon after bold labels (**Composable**: …), or a period / comma in prose.
Sidebar scroll
Section titled “Sidebar scroll”Theme-black does not use Starlight’s #starlight__sidebar / SidebarPersister. Do not add that id: it freezes the main thread with this theme.
Scroll restore for the theme sidebar lives in src/components/overrides/head.astro (aside.aside .sidebar + sessionStorage). Prefer extending that script over a custom Sidebar override.
Checklist before PR
Section titled “Checklist before PR”- Overview vs Examples split is clear (no duplicate nav items)
- Demo is registered and renders in
CodePreview - Mock data is deterministic
- Sidebar entry added in
astro.config.mtsandpnpm run check:sidebarpasses - Internal links point at the new paths (homepage / changelog / related Next Steps when relevant)
-
pnpm run build(or at leastastro check) passes
Related
Section titled “Related”- Contributing Code: fork, branch, registry build
- Component Request / Feature Request
- CLAUDE.md: component layering and registry rules