Skip to content
Niko Table

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/.

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.

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 like simple-table).
  • Grid example slugs: examples/<feature>-grid.
  • Overview never repeats an example’s full tutorial. Link to it instead.
  1. 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() or Date.now()).
  2. Register the demo name: add the string to the Demo union in src/components/markdown/code-preview/_code-preview-internal.tsx. Add it to the lazy import map there too.

  3. Example MDX: create src/content/docs/examples/<name>-grid.mdx with:

    • 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
  4. 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>.mdx or src/content/docs/<slug>/index.mdx.
    • A missing file throws Starlight’s The slug "…" specified in the Starlight sidebar config does not exist error.
    • If the file exists and the error stays, clear .astro/ and restart pnpm dev.
  5. Gallery: add { slug, demo } to the right group in src/data/example-gallery.ts. Use the page’s main CodePreview demo. It then shows as a live card on Table Examples or Grid Examples.

    • A new group also needs a ## Heading and <ExampleGallery group="…" /> on one of those two pages. This puts it in “On this page”.
    • src/data/__tests__/example-gallery.test.ts fails 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.
  6. Cross-links: from Introduction and overview pages, link to the example. Do not paste a second live demo of the same feature into overview.

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.
  • 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”
  • 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.

Avoid em dashes (—). Use a colon after bold labels (**Composable**: …), or a period or comma in prose.

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.

  • 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.mts and pnpm run check:sidebar passes
  • Internal links point at the new paths (homepage, changelog, related Next Steps when relevant)
  • pnpm run build (or at least astro check) passes