MDX components
Doctrine registers its built-ins in every MDX page. Importing is unnecessary inside MDX; component
values and prop types are also public from @amamo/doctrine/components for custom modules.
Built-in components
The sections below document each public component next to its example. An “other attributes” row
means the component also accepts the listed native React attributes, including className, id,
aria-*, and data-*.
Native writing elements
Doctrine also typesets semantic HTML directly, so common writing patterns do not need a React
component. Markdown blockquotes and tables work as usual; MDX can use <details> and <summary> for
disclosure, <kbd> for keyboard input, <mark> for highlights, <dl> for definitions, and
<figure> with <figcaption> for captioned media. They share the theme, narrow-screen behavior,
focus treatment, and print styles.
<details> <summary>Why is the output static?</summary>Every route is prerendered during the build.</details>Press <kbd>Ctrl</kbd> + <kbd>K</kbd> to search.Why is the output static?
Every route is prerendered during the build.
Press Ctrl + K to search.
Headings and table of contents
@amamo/mdx assigns heading IDs and exports the table of contents while compiling each page.
Doctrine renders that metadata into the initial HTML, including inline formatting in headings.
Duplicate headings receive -1, -2, and later suffixes. Append [#custom-id] to choose an
explicit anchor without rendering the suffix:
## Runtime lifecycle [#runtime]Code blocks
Fenced code blocks use One Light and Andromeeda for light and dark mode. They show the detected
language with its icon when available and include a copy action automatically. Add filename="..."
to the fence metadata when a filename should appear:
```ts filename="doctrine.config.ts"export default { title: 'Documentation',}```export default { title: 'Documentation',}Code metadata and inline annotations are handled during compilation. Use {2,4-5} to highlight
lines, /createApp/ to highlight matching words, or // [!code ...] with highlight, focus,
++, --, error, warning, info, or word:value. Annotation comments are omitted from the
rendered and copied code.
```ts filename="app.ts" {1} /createApp/const app = createApp()app.mount('#root')app.start() // [!code ++]```const app = createApp()app.mount('#root')app.start()Callout
Use a callout to separate contextual notes, recommendations, warnings, and blocking problems from the surrounding content.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | Callout body |
title | string | No | — | Heading above the body |
variant | "note" | "tip" | "warning" | "danger" | No | "note" | Color and icon treatment |
| Other attributes | HTMLAttributes<HTMLElement> | No | — | Forwarded to the root <aside> |
<Callout variant="tip" title="Ready to deploy"> Run the production build before uploading `dist`.</Callout>Badge
Use a badge for a short status or label inside a sentence or heading.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | Badge content |
variant | "default" | "outline" | No | "default" | Filled or outlined appearance |
| Other attributes | HTMLAttributes<HTMLSpanElement> | No | — | Forwarded to the root <span> |
<Badge>Stable</Badge> <Badge variant="outline">Preview</Badge>Card and CardGrid
Card
Card is a presentation container, not a link. Put a Markdown link inside when the card should lead
somewhere.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | Card body |
title | string | No | — | Heading above the body |
| Other attributes | HTMLAttributes<HTMLDivElement> | No | — | Forwarded to the root <div> |
<Card title="Installation">Start with [Getting started](/getting-started/).</Card>Installation
CardGrid
Use CardGrid to arrange cards in one column on narrow screens and two columns when space permits.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | Cards or other grid items |
| Other attributes | HTMLAttributes<HTMLDivElement> | No | — | Forwarded to the root <div> |
<CardGrid> <Card title="Installation">Start with [Getting started](/getting-started/).</Card> <Card title="Deployment">Copy the [GitHub Pages workflow](/deployment/).</Card></CardGrid>Installation
Deployment
Steps and Step
Steps
Steps renders an ordered sequence and numbers each direct Step child.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | Sequence of Step elements |
| Other attributes | HTMLAttributes<HTMLOListElement> | No | — | Forwarded to the root <ol> |
<Steps> <Step title="Write">Create an MDX file.</Step> <Step title="Preview">Run the development server.</Step> <Step title="Build">Generate static files.</Step></Steps>Write
Create an MDX file.Preview
Run the development server.Build
Generate static files.
Step
Use Step only inside Steps. The parent list supplies its visible number.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | Step body |
title | string | No | — | Heading above the step body |
| Other attributes | HTMLAttributes<HTMLLIElement> | No | — | Forwarded to the root <li> |
LivePreview
LivePreview renders normal MDX children, so React event handlers hydrate with the page. Pass
source to add an optional native source disclosure; Doctrine does not ship a browser compiler or
editor.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | Yes | — | Rendered preview |
language | string | No | "tsx" | Language label for the optional source block |
source | string | No | — | Source shown in a collapsible block |
title | ReactNode | No | — | Header above the preview |
| Other attributes | Omit<HTMLAttributes<HTMLElement>, "title"> | No | — | Forwarded to the root <section> |
<LivePreview source={`<PreviewCounter />`} title="Interactive counter"> <PreviewCounter /></LivePreview>Sourcetsx
<PreviewCounter />FileTree
FileTree provides the root container for a static semantic file list.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | Yes | — | Folder and file entries |
| Other attributes | HTMLAttributes<HTMLDivElement> | No | — | Forwarded to the root <div> |
<FileTree> <FileTreeFolder name="docs"> <FileTreeFile active name="index.mdx" /> <FileTreeFile name="getting-started.mdx" /> </FileTreeFolder> <FileTreeFile name="doctrine.config.ts" /> <FileTreeFile name="package.json" /></FileTree>- docs
- index.mdx
- getting-started.mdx
- doctrine.config.ts
- package.json
FileTreeFolder
Use FileTreeFolder inside FileTree to group nested folders and files.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | Yes | — | Nested folder and file entries |
name | ReactNode | Yes | — | Visible folder name |
| Other attributes | HTMLAttributes<HTMLLIElement> | No | — | Forwarded to the root <li> |
FileTreeFile
Use FileTreeFile inside FileTree or FileTreeFolder. Set active only on the file represented by
the current example.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
active | boolean | No | false | Marks the current file |
name | ReactNode | Yes | — | Visible file name |
| Other attributes | HTMLAttributes<HTMLLIElement> | No | — | Forwarded to the root <li> |
InstallTabs
InstallTabs renders the pnpm, npm, Yarn, and Bun install commands for one package.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
dev | boolean | No | false | Adds each manager's dev flag |
packageName | string | Yes | — | Package passed to every command |
<InstallTabs packageName="@amamo/doctrine" />pnpm add @amamo/doctrinenpm install @amamo/doctrineyarn add @amamo/doctrinebun add @amamo/doctrineTabs and Tab
Tabs
Use Tabs to group related panels. It selects the first Tab when defaultValue is omitted.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | Yes | — | Sequence of Tab elements |
className | string | No | — | Class on the root element |
defaultValue | string | No | First tab value | Initially selected tab |
variant | "default" | "line" | No | "default" | Tab-list appearance |
<Tabs defaultValue="preview" variant="line"> <Tab label="Preview" value="preview"> Rendered output </Tab> <Tab label="Source" value="source"> MDX source </Tab></Tabs>Rendered output
MDX source
Tab
Use Tab only inside Tabs; it declares one tab control and its matching panel.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | Yes | — | Panel content |
label | ReactNode | Yes | — | Tab control content |
value | string | No | Zero-based index | Stable tab and panel key |
To add project-specific names or override a built-in, continue with Customization.