Skip to main content
DocSearch provides extensive styling options through CSS custom properties (variables), allowing you to match your brand and design system without writing custom CSS.

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 when theme="dark":
This sets data-theme="dark" on the document, which activates dark mode variables:

Component Styling

Search Button

Customize the button:

Search Modal

Resize and position the modal:

Search Input

Search Results

Style individual hits:

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:

CSS Class Reference

Container

  • .DocSearch-Container - Modal overlay
  • .DocSearch-Modal - Main modal
  • .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
  • .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