Documentation Guidelines
How to write docs, examples and sidebar entries for Niko Table and Niko Grid.
Use this page when you add or move docs. The site is Astro Starlight. Demos come from example files under src/registry/new-york/examples/.
Information architecture
Section titled “Information architecture”Keep API and overview pages apart 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/ |
| Niko Grid | Introduction + overview by layer + API Reference | src/content/docs/data-grid/ |
| Niko Grid Examples | Grid demos (Basic Grid, Cell Types, Validation, …) | src/content/docs/examples/ |
Niko Grid overview pages mirror the source tree (grid/components, grid/core, grid/hooks, …). Put feature walkthroughs with a live demo under Niko Grid Examples, not overview.
Reference: Basic Grid is a small 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 repeats an example’s full tutorial. Link to it instead.
Adding a Niko Grid Example
Section titled “Adding a Niko 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 fixed mock data (no
Math.random()orDate.now()).
- Import only from
-
Register the demo name: add the string to the
Demounion insrc/components/markdown/code-preview/_code-preview-internal.tsx. Add it to the lazy import map there too. -
Example MDX: create
src/content/docs/examples/<name>-grid.mdxwith:- Short pitch (1 to 2 sentences)
<CodePreview demo="niko-table/…" />- Optional
<CollapsiblePreview>+ state demo - Installation (
CliCommandCode) - Optional short “What’s included” or usage notes
- Next links to related overview pages or examples
-
Sidebar: add an entry under Niko Grid Examples in
astro.config.mts(slug: "examples/<name>-grid").- The slug must match a file at
src/content/docs/<slug>.mdxorsrc/content/docs/<slug>/index.mdx. - A missing file throws Starlight’s
The slug "…" specified in the Starlight sidebar config does not existerror. - If the file exists and the error stays, clear
.astro/and restartpnpm dev.
- The slug must match a file at
-
Gallery: add
{ slug, demo }to the right group insrc/data/example-gallery.ts. Use the page’s mainCodePreviewdemo. It then shows as a live card on Table Examples or Grid Examples.- A new group also needs a
## Headingand<ExampleGallery group="…" />on one of those two pages. This puts it in “On this page”. src/data/__tests__/example-gallery.test.tsfails if an example page is missing from the gallery. It also fails if the gallery lists a page or demo that does not exist.- This applies to table examples too, not only grids.
- A new group also needs a
-
Cross-links: from Introduction and overview pages, link to the example. Do not paste a second live demo of the same feature into overview.
Changelog
Section titled “Changelog”The Changelog page is for readers. Keep it plain and short. Put full technical detail in CHANGELOG.md at the repo root.
- Lead with what changed for the user.
- One bold lead-in and one short sentence per bullet. Extra facts go in sub-bullets.
- Group by month, then New, Changed, Removed, Fixed, Faster.
- Call out breaking changes in the bullet.
- Link to the page that shows the feature.
Page patterns
Section titled “Page patterns”Overview (API by layer)
Section titled “Overview (API by layer)”- A Source Code or related DocsLink row at the top, when useful
- Props tables and import paths by file
- Links 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
- Deeper theory goes in overview. Keep the example focused.
Use trailing slashes in hardcoded hrefs and markdown links, e.g. /examples/basic-grid/. Dev accepts both with trailingSlash: "ignore". Slashed links match production directory URLs.
Punctuation
Section titled “Punctuation”Avoid em dashes (—). Use a colon after bold labels (**Composable**: …), or a period or comma in prose.
Sidebar scroll
Section titled “Sidebar scroll”Theme-black does not use Starlight’s #starlight__sidebar or 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 plus sessionStorage). Extend that script instead of writing 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 and Feature Request
- CLAUDE.md: component layers and registry rules