Skip to main content
OwnDocs

Snippets

1 min readStableIntermediate

The <Snippet> component embeds reusable MDX fragments from the top-level snippets/ directory. Author a shared block once and reference it anywhere.

Quick Start

Reference a snippet by its path, without the extension.

ℹ️ NOTE This is a reusable snippet from snippets/install-note.mdx. Edit the file once and every page that embeds it picks up the change.

Bash
Bash
npm install @your-org/sdk

Adding Options

Include the .mdx extension explicitly. Both forms resolve to the same file.

ℹ️ NOTE This is a reusable snippet from snippets/install-note.mdx. Edit the file once and every page that embeds it picks up the change.

Bash
Bash
npm install @your-org/sdk

Advanced

Reference snippets from nested folders. The path is relative to snippets/ and resolves to snippets/legal/privacy-notice.mdx.

MDX
MDX
<Snippet path="legal/privacy-notice" />

Paths are restricted to snippets/. Path traversal, absolute paths, and Windows-style backslash separators are rejected. A missing snippet renders an inline error banner instead of failing the page build.

Options

pathstringrequired

Path relative to snippets/. The .mdx extension is optional and is appended when omitted. Nested paths such as legal/privacy-notice are supported.

Was this page helpful?