Integrate with Fumadocs
Integrate with Fumadocs
Fumadocs owns the docs UI — sidebar, layout, theme, search input, route handlers. Leadtype owns the content pipeline — <include> expansion, frontmatter resolution, the typed tag contract, and the agent/LLM artifacts. The two pair naturally: fumadocs reads source MDX, leadtype provides the source primitive and the build-time transforms that go through fumadocs's MDX compiler.
This page covers the wiring. For everything fumadocs does after that, see fumadocs's own docs.
TL;DR
That's the minimum. The rest of this page covers DocsLayout wiring, page rendering, custom-tag mapping, and search.
Install
Leadtype declares fumadocs-core >= 15 as an optional peer dependency — install it explicitly when you want the adapter.
Wire the source
fumadocsSource() pre-walks contentDir, returns a synchronous Source for fumadocs, and exposes the underlying DocsSource on source.leadtype for loadPage() / buildSearchIndex() / resolveInclude().
Add the source preset to your MDX compiler
Leadtype's MDX-source preset expands <include>, resolves <ExtractedTypeTable>, and strips authoring imports — at build time. Everything else stays JSX for your runtime components.
The same plugin list works with @mdx-js/rollup, fumadocs-mdx, and any other MDX compiler that accepts a remark plugin list. Set typeTableBasePath to the source root that contains files referenced by <ExtractedTypeTable path="…">.
Implement the tag components
Use the prop types from leadtype/mdx so your components type-check against the same contract the source preset expects:
See MDX tag contract for the full prop list across all 14 tags.
Load a page from a server component
If you prefer fumadocs's built-in page resolution, call source.getPage(slug) and import the source .mdx directly through fumadocs-mdx as you normally would — the createMdxSourcePlugins() preset will resolve includes during MDX compilation.
Add search
Build a search index from the same source:
For provider-specific search (Vercel AI, TanStack, Cloudflare), wire the bundle into a leadtype/search/* adapter. See Search.