dioxus-docs-kit
Reusable documentation site kit for Dioxus applications.
Drop-in layout with sidebar navigation, full-text search, page navigation, OpenAPI API reference pages, mobile drawer, and theme toggle. Built on dioxus-mdx for content rendering.
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
1. Build a Registry
The DocsRegistry holds all parsed content, the navigation tree, the search index, and any OpenAPI specs:
use ;
use LazyLock;
static DOCS: = new;
2. Wire Into Your Router
Create a thin layout wrapper that provides the DocsContext and registry to the library components:
use *;
use ;
3. Add Routes
That's it. The library handles sidebar rendering, search, page content, previous/next navigation, and mobile responsiveness.
Components
| Component | Description |
|---|---|
DocsLayout |
Full page layout with sidebar, content area, and table of contents |
DocsSidebar |
Navigation sidebar built from _nav.json |
DocsPageContent |
Renders MDX docs or OpenAPI endpoint pages |
DocsPageNav |
Previous/next page navigation |
SearchModal |
Full-text search across all docs |
SearchButton |
Trigger button for the search modal |
MobileDrawer |
Mobile navigation drawer |
ThemeToggle |
Light/dark theme switcher |
Navigation Config
Define your docs structure in _nav.json:
Content Pipeline
All doc content is embedded at compile time via include_str!(). A typical build.rs reads _nav.json, collects all referenced .mdx files, and generates a HashMap<&'static str, &'static str> mapping paths to content.
See the example project for a complete build.rs implementation.
Styling Setup
This crate requires Tailwind CSS 4, DaisyUI 5, and @tailwindcss/typography.
Install dependencies
Configure Tailwind
Add to your tailwind.css:
@@/@}
@//**/}";
Include dioxus-docs-kit classes
When using as a git or crates.io dependency, Tailwind can't scan the crate source
(it lives in ~/.cargo with machine-specific paths). Copy safelist.html from the
crate into your project root and add it as a source:
@/
The safelist includes all classes from both dioxus-docs-kit and dioxus-mdx, including
dynamic runtime classes that Tailwind cannot detect from source scanning alone.
When using as a workspace path dependency, you can point directly at the source instead:
@////**/@////**/
Features
web(default) — enables web-specific features (propagated todioxus-mdx)
License
MIT