OrbitDocs packages are coming to npm soon. Until then, run it from the GitHub repo →
Customize

MDX components

See which components every guide can use, add more Fumadocs components such as a file tree or image zoom, and register your own.

Guides can use a set of components with no import. This page shows what's registered, how to add the Fumadocs components that aren't, and how to add your own. For how to write with each component, see Components.

What every guide can use

ComponentFromNotes
CalloutFumadocstype: info (default), warn, warning, error, success, idea. Optional title and icon.
Card, CardsFumadocstitle, description, href, icon, external.
Steps, StepFumadocsNumbered steps.
Tabs, TabFumadocsitems, defaultIndex, label, and groupId, persist, updateAnchor (see below).
Accordions, AccordionFumadocsAccordion takes a title.
TypeTableFumadocsA props or options table.
Headings, links, images, tables, code blocksFumadocsHeadings get anchor links; op: links resolve to operations.
EndpointOrbitDocsMethod badge and path linking to an operation.
Landing components (Hero, Features, …)OrbitDocsSee Landing pages.

They are registered by orbitMdxComponents(orbit, …) in app/(guides)/[...slug]/page.tsx.

Keep tabs in sync

Tabs with the same groupId switch together across the page. persist remembers the choice across visits; updateAnchor writes the tab to the URL hash.

<Tabs groupId="language" persist items={['TypeScript', 'Python']}>
  <Tab value="TypeScript">…</Tab>
  <Tab value="Python">…</Tab>
</Tabs>

Register more components

Pass extra components as the second argument of orbitMdxComponents. They are merged over the defaults, so you can also replace a default (such as img).

app/(guides)/[...slug]/page.tsx
import { GuidePage } from '@orbitdocs/next';
import { orbitMdxComponents } from '@orbitdocs/next/mdx';
import { File, Files, Folder } from 'fumadocs-ui/components/files';
import { ImageZoom } from 'fumadocs-ui/components/image-zoom';
import { InlineTOC } from 'fumadocs-ui/components/inline-toc';
import { createRelativeLink } from 'fumadocs-ui/mdx';

import { PricingTable } from '@/components/pricing-table';

// …
<GuidePage
  config={orbit}
  page={page}
  components={
    orbitMdxComponents(orbit, {
      a: createRelativeLink(source, page),
      // Fumadocs extras
      File,
      Files,
      Folder,
      InlineTOC,
      // Click any image to zoom
      img: (props) => <ImageZoom {...(props as any)} />,
      // Your own component
      PricingTable,
    }) as Record<string, unknown>
  }
/>

op: links keep working when you replace a: OrbitDocs wraps whatever link component you pass.

File tree

<Files>
  <Folder name="src" defaultOpen>
    <File name="main.ts" />
    <File name="app.module.ts" />
  </Folder>
  <File name="package.json" />
</Files>

Inline table of contents

toc is available in every MDX file:

<InlineTOC items={toc} />

Image zoom

With img replaced as above, every Markdown image (![Alt](/screenshot.png)) opens full size on click. ImageZoom loads its own CSS.

Fumadocs components not registered by default

ComponentImport fromUse it for
Files, Folder, Filefumadocs-ui/components/filesFile and folder trees.
ImageZoomfumadocs-ui/components/image-zoomZoomable images.
InlineTOCfumadocs-ui/components/inline-tocA collapsible table of contents inside the page.
Bannerfumadocs-ui/components/bannerA banner inside a page (the site banner is set with banner in the config).
GithubInfofumadocs-ui/components/github-infoStars and forks of a repository.
DynamicCodeBlockfumadocs-ui/components/dynamic-codeblockHighlighting code that is only known at runtime.

Next steps

Last updated on

On this page