snippets/ directory, import it wherever you need it, and updates propagate everywhere automatically.
Files inside
snippets/ are not rendered as standalone pages. They only appear where you import them.Content snippets
The simplest pattern: write MDX content in a snippet file and import it as a component.snippets/prerequisites.mdx
your-page.mdx
Variable snippets
Export named constants from a snippet file to reuse values like product names, version numbers, or URLs.snippets/vars.mdx
your-page.mdx
Component snippets
For snippets that need to vary based on where they’re used, export an arrow function component that accepts props.snippets/endpoint-note.mdx
- Use arrow function syntax (
const Foo = () => ...). - The
functionkeyword is not supported in snippet files. - MDX syntax doesn’t compile inside arrow function bodies. Use plain HTML tags there, or use a default export instead.
your-page.mdx
Snippets importing snippets
Snippets can import other snippets, which is useful for composing larger shared sections from smaller pieces.snippets/auth-intro.mdx