Overview
Mintlify Components uses a combination of CSS custom properties (variables) and Tailwind CSS configuration to provide a flexible theming system. You can customize colors, typography, and other design tokens to match your brand.Theme Variables
The library defines theme variables in the@theme directive within the main stylesheet. These variables can be overridden in your own CSS.
Default Theme Colors
Frompackages/components/src/styles.css:12-18:
These theme variables are used throughout the component library and automatically adapt to both light and dark modes.
Overriding Theme Variables
To customize the theme, override these variables in your own stylesheet:Dark Mode
Mintlify Components provides full dark mode support using a class-based approach. Dark mode is activated when thedark class is present on the html element.
Dark Mode Implementation
Frompackages/components/src/styles.css:10:
.dark ancestor.
Detecting Dark Mode
You can detect the current theme by checking for thedark class on the document element:
This hook uses a
MutationObserver to watch for changes to the html element’s class list, ensuring your components stay in sync with theme changes.Custom Utilities
Mintlify Components includes custom Tailwind utilities that you can use in your applications.Border Standard
A utility for consistent borders across light and dark modes:Overflow Wrap Anywhere
For better text wrapping in tight spaces:Custom Plugins
The library includes two custom Tailwind plugins that extend the default functionality.Background Grid Plugin
Creates grid patterns for backgrounds using SVG data URIs:Scrollbar Plugin
Provides styled scrollbars with theme-aware colors:scrollbar-common: General purpose scrollbar that adapts to light/dark modescrollbar-code-system: System theme-aware scrollbar for code blocksscrollbar-code-dark: Always dark scrollbar for code blocks
Component-Specific Theming
Some components support custom theming through props.Callout with Custom Colors
Frompackages/components/src/components/callout/callout.tsx:98-136:
Code Block Themes
system: Adapts to the current light/dark modedark: Always uses dark theme
Typography
The library includes font feature settings for improved typography:cv02: Alternative glyph for lowercase ‘a’cv03: Alternative glyph for lowercase ‘g’cv04: Alternative glyph for lowercase ‘i’ and ‘l’cv11: Alternative glyph for numerals
These font features only apply if your chosen font supports them.
Best Practices
Next Steps
Learn more about styling components with Tailwind CSS in the Styling Guide.