Custom Components
Reusable Components
Reusable, custom component snippets
Much like custom content snippets that can be added in MDX files, you can add reusable components as snippets.
Creating a reusable React component
- Inside your snippet file, create a component that takes in props by exporting your component in the form of an arrow function.
snippets/custom-component.mdx
MDX does not compile inside the body of an arrow function. Stick to HTML syntax when you can or use a default export if you need to use MDX inside of your component.
- Import the snippet into your destination file and pass in the props
destination-file.mdx
Client-Side Content
By default, Mintlify employs server-side rendering, generating content
at build time. For client-side content loading, ensure to verify the
document
object’s availability before initiating the rendering process.
snippets/client-component.mdx
Was this page helpful?