Documentation

Components

Components

Leadtype does not ship UI components. Your docs app owns runtime rendering, styling, and accessibility — it only has to honor a small naming contract so the remark pipeline can flatten each component into markdown for agents, search, and llms-full.txt.

Why flatten at all?

Interactive MDX components like <Tabs> or <Callout> render fine in a browser but do nothing for an agent reading raw text. Flattening converts each component into a portable markdown equivalent at conversion time:

  • A <Callout> becomes a blockquote.
  • A <Tabs> becomes a stack of bold headings, one per tab.
  • A <TypeTable> becomes a markdown table.
  • A <Mermaid> becomes a fenced ```mermaid block — the diagram source survives so other tooling can render it.

This means the same content reaches three audiences (humans, agents, search) without you maintaining two copies.

The naming contract

The remark pipeline recognizes these names. If your components use the same names, flattening Just Works:

Accordion, AccordionItem, Audience, Callout, Card, Cards, CommandTabs, Details, Example, ExtractedTypeTable, File, FileTree, Folder, Mermaid, Prompt, Section, Selector, Step, Steps, Tab, Tabs, TopicSwitcher, TypeTable.

If your app uses different names, you have two options: rename to match, or add a custom remark plugin that maps your names back to the contract above.

Runtime registration, heading IDs, and "On this page" sidebars are docs-app concerns. See Render MDX and TOC for that setup.

Reuse shared content

Use include tags when several pages need the same explanation, warning, setup step, or code sample. leadtype generate and leadtype lint handle includes automatically. Add remarkInclude before the default plugin stack in custom conversion scripts:

Include a whole markdown or MDX partial with src or text content:

You can also include code files. Leadtype emits them as fenced code blocks:

To reuse only one block from a larger file, append #section-id and wrap that block in a lowercase HTML section:

Section reuse matches lowercase <section id="..."> only. A capitalized <Section id="..."> component is flattened later for markdown output, but it is not an include anchor.

Relative paths resolve from the including file first. Nested includes are supported, so a shared partial can include files next to itself. See Remark plugins for base paths and plugin details.

Component reference

Each section below shows the authored MDX and a live render.

Switch to the agent view (the robot icon in the example app header) to see the flattened markdown side-by-side.

Callout

Wraps supporting context, warnings, or tips. Variants change styling but flatten identically into a blockquote.

Heads up

Callouts wrap supporting context, warnings, or tips. The remark pipeline flattens them into blockquotes so agents still see the content.

Cards

A grid of short, linked entry points. Flattens to a bullet list of links.

Steps

Numbered walkthroughs. Flattens to an ordered list with bold step titles.

Use the components in this list as authoring affordances.

leadtype generate writes flattened markdown to public/docs/.

HTML for humans, .md for agents — same URL, content negotiated by the Accept header.

Tabs

Group equivalent content. Flattens to bold headings followed by content so agents do not need a JSX-aware renderer to read every variant.

Use a Vite middleware (dev/preview) and a Nitro middleware (prod) to negotiate the Accept header.

CommandTabs

Package-manager-aware install or run commands. Flattens to a markdown table with one row per manager.

Use mode="install" when command is a package name, mode="run" when command is a CLI name, and mode="create" for starter commands. Use the commands prop for exact per-manager overrides.

npm install leadtype
npx leadtype lint

Prompt

Displays an agent-ready prompt with a copy action. Flattening preserves the prompt body as a fenced prompt block so copied instructions also survive in .md, root llms-full.txt, and bundled AGENTS.md output.

Copy prompt for your coding agent

Use this after generating artifacts.

Inspect public/docs/agent-readability.json, then wire markdown responses before the HTML docs route.

Audience

Splits browser-only and agent-only guidance without forking the page. Human content renders in the docs UI and is omitted from markdown output; agent content is hidden in the browser and included in generated markdown.

This sentence renders for human readers in the browser.

FileTree

Shows project structure in guides and release instructions. Flattening emits a fenced text tree so agents can read the same hierarchy without JSX.

public/
llms.txt
docs/
index.md

Accordion

Collapsible details for secondary content. Flattening ignores open/closed state and emits every item — accordions are not a place to hide content from agents.

When should I use accordions?

Use them for supporting details, troubleshooting notes, and optional reference material. Closed content is still flattened by the remark pipeline.

Are accordions a good place to hide content from LLMs?

No. Conversion ignores the open/closed state and emits everything inside.

TopicSwitcher

Navigation across equivalent docs topics — frameworks, SDKs, runtimes, deployment targets, product areas. Reader-facing only; it does not automatically read LLM topic config.

TypeTable and ExtractedTypeTable

TypeTable is for explicit prop or type rows you already know. ExtractedTypeTable reads a TypeScript file at conversion time and extracts the table from a named type — keep its path stable.

NameTypeDefaultDescription
titlerequiredstring-Heading rendered above the callout body.
variantCalloutVariantinfoVisual treatment for the callout.
deprecatedbooleanfalseMarks the row as deprecated.

Example

Data-driven preview and source examples. The host component receives code as data; add file loaders or dynamic imports outside leadtype when an example needs app-specific behavior.

Mermaid

Diagrams authored as plain text. Renders client-side as interactive SVG. Flattening preserves the source as a fenced ```mermaid block so other tools can render the diagram from the markdown copy.

Rendering diagram...

Guidelines

  • Keep runtime components in your docs app. Leadtype stays out of UI.
  • Keep component names stable. Renaming <Callout> breaks the flattening contract until you add a remark plugin to remap.
  • For agent output quality, read the converted .md files first and only edit components or plugin order if the markdown actually looks wrong.