Overview
Meteor Design Tokens support theme customization out of the box, including light and dark mode. You can customize existing themes or create entirely new themes by overriding token values.Light and Dark Mode
Enabling Dark Mode
To enable dark mode, add thedata-theme="dark" attribute to a parent element:
Toggling Dark Mode
Implement a theme toggle using JavaScript:React Example
Vue Example
System Preference Detection
Respect the user’s system color scheme preference:Customizing Token Values
You can override token values to customize the theme:Override Semantic Tokens
Override for Dark Mode
Creating Custom Themes
Method 1: Scoped Theme Attribute
Create completely custom themes using data attributes:Method 2: CSS Classes
Alternatively, use classes for theme switching:Brand Color Customization
For brand-specific customization, override the brand color palette:Multi-Theme Application
Support multiple theme variants in your application:Component-Specific Theming
Apply theme overrides to specific components or sections:High Contrast Mode
Create a high contrast theme for accessibility:CSS-in-JS Theme Provider
React with Context
Smooth Theme Transitions
Add smooth transitions when switching themes:Theme Testing
Test your themes during development:Best Practices
Test in both light and dark modes
Test in both light and dark modes
Always test your UI in both light and dark themes to ensure proper contrast and readability.
Respect user preferences
Respect user preferences
Check system preferences and remember user choices. Don’t force a theme on users.
Override semantic tokens, not primitives
Override semantic tokens, not primitives
When customizing themes, override semantic tokens rather than primitive values to maintain consistency.
Test accessibility
Test accessibility
Ensure your custom themes maintain WCAG contrast ratios for text and interactive elements.
Document custom tokens
Document custom tokens
If creating custom tokens, document their purpose and usage for your team.
Troubleshooting
Dark mode not applying
Dark mode not applying
Ensure you’ve imported both light and dark CSS files, and that the
data-theme="dark" attribute is set on a parent element.Theme flashing on page load
Theme flashing on page load
Apply the theme attribute in a blocking script before the page renders, or use a CSS approach to hide content until theme is set.
Custom tokens not working
Custom tokens not working
Make sure your custom token CSS is loaded after the Meteor token CSS to properly override values.
Next Steps
Usage Guide
Learn more about using tokens in your CSS
Primitives Reference
Explore all available primitive tokens