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.
- 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-sitePaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Docs site from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/template-docs-site
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add template-docs-site
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/code-block/code-block.tsx
- components/ui/knowns/code-block/code-block-utils.ts
- components/ui/knowns/tabs.tsx
- components/ui/knowns/blocks/docs/docs-install.tsx
- components/ui/knowns/blocks/docs/docs-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/menu.tsx
- components/ui/knowns/breadcrumb.tsx
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/blocks/docs/docs-page-header.tsx
- components/ui/knowns/segmented-control.tsx
- components/ui/knowns/blocks/docs/docs-preview.tsx
- components/ui/knowns/blocks/docs/docs-toc.tsx
- components/ui/knowns/blocks/docs/docs-layout.tsx
- components/ui/knowns/animated-number.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/avatar.tsx
- components/ui/knowns/popover.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/sheet.tsx
- components/ui/knowns/blocks/sidebar/sidebar.tsx
- components/ui/knowns/blocks/sidebar/sidebar-utils.ts
- components/ui/knowns/blocks/sidebar/sidebar-docs.tsx
- components/ui/knowns/accordion.tsx
- lib/knowns/home.ts
- lib/knowns/home-utils.ts
- components/ui/knowns/theme-toggle.tsx
- components/ui/knowns/blocks/site/site-header.tsx
- components/ui/knowns/blocks/site/site-utils.ts
- components/ui/knowns/blocks/templates/docs-site.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/template-docs-site, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "template-docs-site" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.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.
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultView | "home" | "install" | "flows" | "approvals" | "webhooks" | "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
- 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.
- 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.
- 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.
- 04Fills the article with install steps, a command block with npm, pnpm, yarn and bun tabs, and a callout.
- 05Sets the page to start on with `defaultView`, and `scrollRoot` makes the header stick to a scrolling box.
- 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
| State | What moves | Timing |
|---|---|---|
| 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
- Only the navigation tree: use Sidebar.
- A blog or changelog: use Changelog Feed.
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" }).