Requirements
Before you begin, ensure you have:- Node.js >= 20.0.0
- React ^18.0.0 or ^19.0.0
- Tailwind CSS v3 or v4
Installation
Tailwind CSS v4 Setup
Tailwind v4 uses a new CSS-first configuration approach with
@theme directives.styles.css
Available Theme Variables
Customize the component appearance using these CSS variables:| Variable | Description | Default |
|---|---|---|
--color-primary | Primary brand color | rgb(22, 101, 52) |
--color-primary-light | Light variant of primary color | rgb(240, 249, 244) |
--color-primary-dark | Dark variant of primary color | rgb(45, 90, 61) |
--color-tooltip-foreground | Tooltip text color | rgb(255, 255, 255) |
--color-background-dark | Dark mode background | rgb(14, 14, 15) |
Complete Example
styles.css
Tailwind CSS v3 Setup
For Tailwind v3, import the component styles at the top of your CSS file:styles.css
Configuration File
Create or update yourtailwind.config.js to customize the theme:
tailwind.config.js
Make sure to include the component files in your
content array so Tailwind can detect which classes are being used.Using the cn Utility
The library exports acn utility function for merging Tailwind classes. This utility combines clsx and tailwind-merge to intelligently merge class names and resolve conflicts:
cn utility is especially useful when:
- Combining conditional classes
- Merging user-provided className props
- Resolving conflicting Tailwind classes (e.g.,
text-blue-500andtext-red-500won’t both apply)
Working with Component Styles
Understanding Dark Mode Classes
Components use Tailwind’sdark: variant for dark mode styling. For example, the Callout component uses classes like:
Custom Styling Components
You can override component styles using theclassName prop:
Advanced Tailwind Features
Using Arbitrary Values
The library supports Tailwind’s arbitrary value syntax:Responsive Design
All components work seamlessly with Tailwind’s responsive modifiers:Troubleshooting
Components are unstyled
Components are unstyled
Ensure you’ve imported For Tailwind v4:
@mintlify/components/styles.css at the top of your CSS file, before Tailwind imports.For Tailwind v3:Custom colors not applying
Custom colors not applying
In Tailwind v4, verify that your
@theme block comes after the component imports. In v3, check that you’re extending the theme correctly in tailwind.config.js.Also ensure you’re using the correct CSS variable names like --color-primary and --color-primary-dark.Missing styles in production
Missing styles in production
Make sure the component files are included in your Tailwind
content configuration:tailwind.config.js
Classes not being purged correctly
Classes not being purged correctly
If you’re seeing unused styles or missing styles in production, verify your PurgeCSS/content configuration includes both your source files and the component library.
Next Steps
Dark Mode
Set up dark mode and customize theme colors
TypeScript
Learn about TypeScript types and exports