CSS Variables
All theme customization is done through CSS variables in the:root scope.
Color Variables
Text Colors
UI Colors
Spacing & Layout
Shadows
Border Radius
Typography
Icons
Transitions
Z-Index Layers
Component-Specific Variables
Chat Component
Autocomplete Component
Creating a Custom Theme
Simple Color Override
Start with a base theme and override specific colors:Complete Custom Theme
Build a theme from scratch using the reset:Theme Examples
Purple Theme
Dark Theme
Minimalist Theme
Dark Mode
Automatic Dark Mode
Use the built-in dark mode by settingdata-theme or a class:
Custom Dark Mode
Define your own dark mode variables:System Preference
Respect user’s system preference:Responsive Spacing
InstantSearch.css automatically increases spacing on touch devices:Best Practices
Use RGB values
Colors use RGB values without the
rgb() function to support alpha channels:Test both themes
Always test your custom theme in both light and dark modes
Maintain contrast
Ensure sufficient color contrast for accessibility (WCAG AA: 4.5:1 for text)
Use calc() for derived values
Leverage CSS calc() for spacing and sizing:
Debugging
Inspect the computed values in DevTools:Next Steps
CSS Classes
See all available CSS classes for customization
InstantSearch.css
Back to InstantSearch.css overview