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

Components

Callouts, steps, tabs, cards, accordions, type tables and code blocks you can use in any page.

Every component on this page works in any MDX file in content/ or reference/, without an import. Each section shows the code, then the result.

Callout

Draws attention to a note, a tip or a gotcha.

<Callout type="warn" title="Keys are secret">
  Never send your API key from a browser.
</Callout>

Keys are secret

Never send your API key from a browser.

PropTypeDefault
typeinfo, warn, error, success, warning or ideainfo
titleTextNone
iconA React elementThe type's icon

warning is the same as warn.

GitHub alerts

GitHub's alert syntax works too, in guides, in reference/<api>/*.mdx and in descriptions from the spec:

> [!TIP]
> Send an `Idempotency-Key` with every booking.

Tip

Send an Idempotency-Key with every booking.

AlertCallout typeTitle
[!NOTE]infoNote
[!TIP]successTip
[!IMPORTANT]ideaImportant
[!WARNING]warningWarning
[!CAUTION]errorCaution

The [!KIND] marker must open the blockquote, on its own line or followed by the text. Other blockquotes stay blockquotes. llms.txt, the /md/ pages and Copy Markdown keep the > [!TIP] form. Apps made before this need mdxOptions: orbitMdxOptions() (from @orbitdocs/next/mdx-plugins) on both collections in lib/source.ts, as orbitdocs init now writes it.

Steps

Numbered steps for a procedure. Put a heading and content inside each Step, with blank lines around Markdown:

<Steps>
<Step>

### Install

Run `npm install @orbitdocs/nestjs`.

</Step>
<Step>

### Mark a route

Add `@DocsOperation()` to a controller method.

</Step>
</Steps>

Install

Run npm install @orbitdocs/nestjs.

Mark a route

Add @DocsOperation() to a controller method.

Tabs

Alternatives the reader picks from, such as languages or package managers:

<Tabs items={['npm', 'pnpm']} groupId="package-manager" persist>
  <Tab value="npm">`npm install @orbitdocs/nestjs`</Tab>
  <Tab value="pnpm">`pnpm add @orbitdocs/nestjs`</Tab>
</Tabs>
npm install @orbitdocs/nestjs
PropOnWhat it does
itemsTabsTab labels, in order.
defaultIndexTabsThe tab open first. Default 0.
groupIdTabsTab sets with the same id switch together, for this browser tab's session.
persistTabsWith groupId, remember the choice across visits.
labelTabsExtra text in the tab bar.
valueTabMust equal one of items.

Cards

Links with a title and a description, in a grid:

<Cards>
  <Card title="Quickstart" href="/get-started/quickstart" description="Docs for your Nest app in five minutes." />
  <Card title="GitHub" href="https://github.com/VitraAI/OrbitDocs" description="Source code." external />
</Cards>

Card takes title, description, href, icon (a React element) and external. A card without href is a plain box.

Accordions

Collapsed details, for FAQs and long options:

<Accordions>
  <Accordion title="Does extraction start my database?">
    No. Providers are never created in preview mode.
  </Accordion>
  <Accordion title="Can I use a spec file instead?" id="spec-file">
    Yes. Use `source: { file: './openapi.yaml' }`.
  </Accordion>
</Accordions>

Accordion takes title and an optional id. With an id, the URL #spec-file opens that item.

TypeTable

A table of options or fields, with types and defaults:

<TypeTable
  type={{
    group: { type: 'string', description: 'Sidebar group.' },
    order: { type: 'number', description: 'Position in the group.', default: 'last' },
    title: { type: 'string', description: 'Operation title.', required: true },
  }}
/>

Prop

Type

Each field takes type, description, default, required, deprecated, and typeDescription (the full type, shown on click).

Code blocks

Fenced code blocks are highlighted and get a copy button. Add a title after the language:

```ts title="src/main.ts"
await app.listen(3000);
```
src/main.ts
await app.listen(3000);

Highlight lines, show diffs, focus

Add a comment at the end of a line. The comment is removed from the output:

```ts
const app = await NestFactory.create(AppModule);
mountOrbitDocs(app, { root, path: '/docs' }); 
await app.listen(3000); 
await app.listen(3010); 
```
const app = await NestFactory.create(AppModule);
mountOrbitDocs(app, { root, path: '/docs' }); 
await app.listen(3000); 
await app.listen(3010); 
CommentEffect
// [!code highlight]Highlights the line
// [!code ++] and // [!code --]Marks an added or removed line
// [!code focus]Dims every other line
// [!code word:baseUrl]Highlights a word

Use the comment syntax of the block's language, such as # [!code ++] in shell.

Line numbers

```ts lineNumbers
const a = 1;
const b = 2;
```

Code tabs

Consecutive code blocks with a tab attribute become one tabbed block:

```ts tab="TypeScript"
const booking = await orbit.bookings.create({ flightId });
```

```python tab="Python"
booking = orbit.bookings.create(flight_id=flight_id)
```
const booking = await orbit.bookings.create({ flightId });

Package manager tabs

A block with the language npm becomes tabs for npm, pnpm, yarn and bun:

```npm
npm install @orbitdocs/nestjs
```
npm install @orbitdocs/nestjs

[Create a booking](op:demo/create-a-booking) links to an operation, and <Endpoint api="demo" op="create-a-booking" /> shows its method and path: POST /v1/bookings. See Linking operations.

Landing components

Hero, Features, ApiCards, CodeShowcase, Stats, Logos and CallToAction build landing pages. They also work on any page. See Landing pages.

Next steps

Last updated on

On this page