Quick Start
Import Default Styles
First, import the base DocSearch CSS:Apply a Theme
DocSearch supports light and dark themes:CSS Variables
DocSearch uses CSS custom properties for styling. Override them to customize appearance:All CSS variables are scoped to
:root and can be overridden at any level.Color Variables
Primary Colors
Control brand colors throughout the interface:Text Colors
Background Colors
Semantic Colors
Dark Theme
DocSearch automatically switches to dark theme whentheme="dark":
data-theme="dark" on the document, which activates dark mode variables:
Complete Dark Theme Variables
Complete Dark Theme Variables
Component Styling
Search Button
Search Modal
Resize and position the modal:Search Input
Search Results
Style individual hits:Footer
Ask AI Styling
Customize the AI-powered search interface:Ask AI Screen
Messages
Markdown Content
Source Citations
Action Buttons
Responsive Styles
DocSearch adapts to mobile devices:Custom Themes Example
Brand Integration
High Contrast Theme
Minimal Theme
Advanced Customization
Custom Hit Component
Replace the default hit rendering:Custom Footer
CSS Class Reference
Complete CSS Classes
Complete CSS Classes
Container
.DocSearch-Container- Modal overlay.DocSearch-Modal- Main modal
Search
.DocSearch-SearchBar- Search bar container.DocSearch-Form- Search form.DocSearch-Input- Search input.DocSearch-MagnifierLabel- Search icon.DocSearch-LoadingIndicator- Loading spinner
Results
.DocSearch-Dropdown- Results container.DocSearch-Hits- Results list.DocSearch-Hit- Individual result.DocSearch-Hit-Container- Hit content wrapper.DocSearch-Hit-icon- Hit icon.DocSearch-Hit-title- Hit title.DocSearch-Hit-path- Hit breadcrumb
Ask AI
.DocSearch-AskAiScreen- AI screen container.DocSearch-AskAiScreen-Response- Response bubble.DocSearch-AskAiScreen-Query- User question.DocSearch-Markdown-Content- AI response content.DocSearch-AskAiScreen-RelatedSources- Source links.DocSearch-AskAiScreen-ActionButton- Action buttons
Footer
.DocSearch-Footer- Footer container.DocSearch-Logo- Algolia logo.DocSearch-Commands- Keyboard shortcuts
Best Practices
Use CSS Variables
Override variables instead of component classes for maintainability.
Test Both Themes
Ensure your customizations work in both light and dark modes.
Maintain Accessibility
Keep sufficient color contrast for readability.
Mobile First
Test responsive behavior on various screen sizes.
Debugging Styles
Use browser DevTools to inspect and override styles:DocSearch uses the
@docsearch/css package which contains all base styles. Import it before adding custom styles.Next Steps
View Source Styles
Explore the complete CSS source code on GitHub
