Preview component wraps content with a title and border, using the same visual style as code blocks. It’s perfect for highlighting examples or demonstrations in your documentation.
Basic Usage
Wrap any content with the Preview component:Preview
Properties
The content to display in the preview area. Can be any valid React node.
Title displayed in the header. Defaults to “Preview” if not specified.
Additional CSS classes to apply to the container element.
With Custom Title
Add a custom title to provide context:Component Example
Features
Consistent Styling
The component uses the same visual design as Mintlify code blocks:- Rounded corners and subtle border
- Title header with proper spacing
- Light/dark mode support
- Scrollable content area
Dark Mode
Automatically adapts to Mintlify’s theme:- Light backgrounds in light mode
- Dark backgrounds in dark mode
- Proper contrast for all text and borders
Use Cases
Component Demonstrations
Show interactive components:Alert Component
Type Documentation
Display type structures with TypeTree:API Response Structure
Configuration Examples
Document configuration objects:Database Configuration
Integration with MDX
The Preview component works seamlessly in Mintlify MDX files:Best Practices
Use Descriptive Titles
Use Descriptive Titles
Help readers understand what they’re looking at:
Pair with Code Blocks
Pair with Code Blocks
Show the code alongside the preview:
Result
Related Components
Troubleshooting
Component not found
Component not found
If you see
Cannot find module "/snippets/tsdocs/Preview.jsx":- Ensure the component exists in your
docs/snippets/tsdocs/folder - Run
mint-tsdocsto auto-copy the component - Check that the import path is correct
Styling looks wrong
Styling looks wrong
The Preview component relies on Tailwind CSS classes:
- Ensure Tailwind is configured in your Mintlify project
- Check that dark mode is properly set up
- Verify the
scrollbar-*utility classes are available

