Search
Fast client-side search
Instant search with cmd+k support.
Usage
Keyboard shortcuts
- cmd+k - open search
- esc - close search
- arrow keys - navigate results
- enter - select result
Features
- Fuzzy matching
- Ranked results
- Title and description search
- Keyboard navigation
- Responsive modal
Props
| prop | type |
|---|---|
docs | DocMeta[] |
basePath? | string |
adapter? | SearchAdapter |
debounce? | number |
How it works
Search runs entirely client-side using fuzzy matching. When the component mounts, it indexes all doc titles and descriptions.
Indexing
Docs are indexed on mount. Each doc's title and description are tokenized for matching.
Matching
User input is matched against tokens using fuzzy matching with typo tolerance.
Ranking
Results are ranked by relevance. Title matches score higher than description matches.
Search adapter
Create custom search adapters for external services or advanced search.
Interface
Custom adapter
Usage
Customization
Placeholder text
Wrap the search component to customize the placeholder:
Styling
Search uses semantic color variables that adapt to your theme:
--color-bg- modal background--color-surface- input background--color-line- borders--color-fg- text--color-muted- secondary text
Performance
Search is optimized for docs sites up to thousands of pages:
- Local or hosted adapter support
- Debounced input handling
- Virtual scrolling for large result sets
- Minimal bundle size