Skip to content
lobehubPublic

About

πŸ“– Docs Kit - Reusable documentation toolkit and lobedocs CLI for LobeHub component libraries

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

174 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“– Docs Kit

The Documentation Kit for React Component Libraries

LobeHub's documentation toolkit and lobedocs CLI. Write MDX next to your React components and get a prerendered docs site with live demos, API tables, search, skills.md and llms.txt.

Live Example Β· Changelog Β· Report Bug Β· Request Feature


Table of contents

TOC

✨ Why Docs Kit?

Docs Kit is the documentation stack behind ui.lobehub.com and the other LobeHub component library sites. It replaces dumi + dumi-theme-lobehub with one installable package: your repo keeps the content and a config file, and the lobedocs CLI does the rest.

  • Zero build config: no vite.config.ts or react-router.config.ts in your repo; the CLI owns them.
  • Docs next to code: every src/**/index.mdx becomes a component page with live, editable <Demo /> blocks.
  • API tables from TypeScript: <Api name="Button" /> reads props, JSDoc and @default from your types, and the build fails when a default drifts from runtime.
  • Static and fast: every page is prerendered, with Pagefind search, a sitemap and Open Graph tags built in.
  • Audited builds: broken links, missing demos and wrong API defaults fail lobedocs build instead of reaching readers.
  • AI-native docs: coding agents read every page through skills.md and llms.txt, generated from the same MDX your users read.

πŸš€ Getting Started

$ pnpm add -D @lobehub/docs-kit @react-router/dev react-router vite tsx

Docs Kit needs Node.js >= 22.22, React 19, React Router 8.2+ and Vite 8.1+. Add the scripts to your component library's package.json:

{
  "scripts": {
    "docs:dev": "lobedocs dev",
    "docs:build": "lobedocs build",
    "postinstall": "lobedocs typegen"
  }
}

Then add a docs.config.ts at the repo root and a docs/index.mdx with title and description frontmatter:

// docs.config.ts
export default {
  atomDirs: [{ dir: 'src' }],
  title: 'Lobe Editor',
  description: 'One sentence describing the library.',
  siteUrl: 'https://editor.lobehub.com',
  alias: { '@lobehub/editor': 'src' }, // demos import the package by name, run from source
  themeConfig: {
    apiHeader: { packageName: '@lobehub/editor', github: 'https://github.com/lobehub/lobe-editor' },
    socialLinks: [
      { href: 'https://github.com/lobehub/lobe-editor', icon: 'github', label: 'GitHub' },
    ],
  },
};

Run pnpm docs:dev and open the printed URL. Every config field, including the sidebar, home page, theme, giscus and analytics options, is typed in src/config.ts.

πŸ“ Writing Docs

A component page is an index.mdx next to the component. Demo and Api are available in every MDX file without an import:

---
title: Button
description: Button triggers an action. Supports variants, sizes, loading and icon slots.
category: General
---

import Basic from './demos/index.tsx?demo';

<Demo of={Basic} title="Basic usage" />

## API

<Api name="Button" />
  • Only files named index.mdx under an atomDirs root become pages; the URL comes from the folder (src/chat/ChatItem β†’ /components/chat/chat-item).
  • Each demo file has one default export and lives under src/**/demos/.
  • Guide pages are docs/**/*.mdx files listed in publicDocs; themeConfig.sidebarGroups gives them a sidebar section.
  • A custom landing page is any module set as homePage, for example one built from @lobehub/ui/awesome.

⌨️ lobedocs CLI

Command What it does
lobedocs dev Start the dev server with hot reload for MDX, demos and components
lobedocs build Prerender every page, build the search index and agent files, audit the result, write dist/
lobedocs typegen Generate React Router route types into .react-router/types

Extra arguments are forwarded to React Router, e.g. lobedocs dev --port 3000. dist/ is plain static HTML that any static host can serve. Restart lobedocs dev after editing docs.config.ts.

πŸ€– AI-Powered Development

Docs Kit's docs are generated for coding agents as well as people. lobedocs dev serves them live, and lobedocs build writes them into dist/:

Resource What it does
skills.md Agent skill entry point: site config, folder architecture and a Markdown reference for every page
llms.txt Page index with outlines for llms.txt-aware tools
Button skill Example per-page Markdown reference (/skills/<page>.md), with usage, demos and props
Introduction skill Example guide-page skill for getting started

Paste this into Cursor, Claude Code, Codex or any other coding agent:

Read https://docs-kit.lobehub.com/skills.md, then use @lobehub/docs-kit to set up a documentation site for my React component library. Follow the installation, docs.config.ts and component-page conventions documented there.

Works with Cursor, Claude Code, Windsurf, GitHub Copilot and other llms.txt-aware tools.

Working on this repository with an agent? Start from AGENTS.md.

πŸ› οΈ Local Development

You can use Github Codespaces for online development:

Or clone it for local development (Node.js >= 22.22 and pnpm):

$ git clone https://github.com/lobehub/docs-kit.git
$ cd docs-kit
$ pnpm install
$ pnpm dev

pnpm dev runs lobedocs dev against playground/, a consumer site that documents how to use the kit. pnpm build:playground, pnpm test, pnpm lint and pnpm type-check are what CI runs.

🀝 Contributing

Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub Issues to get stuck in to show us what you’re made of.

🩷 Sponsor

Every bit counts and your one-time donation sparkles in our galaxy of support! You're a shooting star, making a swift and bright impact on our journey. Thank you for believing in us – your generosity guides us toward our mission, one brilliant flash at a time.

πŸ”— Links


πŸ“ License

Copyright Β© 2026 LobeHub.
This project is MIT licensed.

About

πŸ“– Docs Kit - Reusable documentation toolkit and lobedocs CLI for LobeHub component libraries

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages