Skip to content

Docs Site

A docs site in one component: a home with search and category cards, then pages with the docs sidebar, page header, install steps, callouts, table of contents and previous and next links.

This page holds the props and the code. See the template, its screens and a live preview.

On this page
Used for
  • Product docs site
  • API reference start
  • Docs home with search
  • Install steps page
  • Docs frame demo

Examples

Installation

npx knowns-ui@latest add template-docs-site
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

defaultView
"home" | "install" | "flows" | "approvals" | "webhooks"
Default"home"
The page to start on.
scrollRoot
HTMLElement | null
The element that scrolls, when the site sits in a box instead of the window.
Data
arrays in the file
SECTIONS, PAGES, CATEGORIES and TOC at the top of the file. The text is demo copy for a fictional product.

What it handles

  1. 01Switches between a docs home and a docs page in place, so the template shows in a single frame; in your app each page is a route.
  2. 02Draws the home with a how-can-we-help headline, a search button with a Cmd K hint and three category cards that link to pages.
  3. 03Builds a page from the real docs blocks: a sidebar of sections, a page header with breadcrumb, a table of contents and a previous and next pager.
  4. 04Fills the article with install steps, a command block with npm, pnpm, yarn and bun tabs, and a callout.
  5. 05Sets the page to start on with `defaultView`, and `scrollRoot` makes the header stick to a scrolling box.
  6. 06Writes its copy for a fictional product, Northwind Flow, as plain data you replace with your own.

States

First render
Nothing. The home paints as it is
none
Open a page
The view swaps to the docs layout at once
none
Hover a category card
The card background changes
120ms, ease out
Previous or next
The article is replaced at once
none

Works with

When to use

When to use

  • Starting a docs site: a home with search and categories, then pages with sidebar, table of contents and pager.
  • Seeing how the docs blocks fit together before wiring them to your own content.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Docs Site to my app and wire it to my own data.
  • I need starting a docs site: a home with search and categories, then pages with sidebar, table of contents and pager. Set that up with the Knowns UI Docs Site.
  • Which Docs Site props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "template-docs-site" }) and search_docs({ query: "docs site" }).

Need help?

Stuck on Docs Site, or found something off? We read every message.