Search Bar
Explore interactive examples and all component variations in our Storybook.
The Search Bar functionality in BuildGrid UI can be implemented using various components like Command, Autocomplete, or a simple Input with search styling. Each approach offers different levels of functionality and user experience.
Simple Search Input
Command Search Bar
Autocomplete Search Bar
Search Bar with Filters
Search Bar Sizes
Implementation Approaches
Using Command Component
The Command component provides the most feature-rich search experience with:
- Built-in keyboard navigation
- Grouped results
- Empty state handling
- Accessible by default
Best for: Command palettes, navigation search, complex filtering
Using Autocomplete Component
The Autocomplete component offers:
- Real-time filtering
- Option selection
- Customizable dropdown positioning
- Clear selection functionality
Best for: Form inputs, data selection, filtered searches
Using Input Component
A simple Input with search styling provides:
- Lightweight implementation
- Full control over behavior
- Easy customization
- Minimal dependencies
Best for: Simple search forms, basic filtering, custom implementations
Properties
Command-based Search Bar
Uses the Command component properties. See Command documentation for full details.
Autocomplete-based Search Bar
Uses the Autocomplete component properties. See Autocomplete documentation for full details.
Input-based Search Bar
Uses the Input component properties. See Input documentation for full details.
Accessibility
All search bar implementations include:
- Keyboard Navigation - Tab, Enter, Escape, and arrow keys
- Screen Reader Support - Proper ARIA labels and roles
- Focus Management - Clear focus indicators and logical tab order
- Search Announcements - Results and state changes announced to screen readers
Common Use Cases
Search bars are perfect for:
- Site Search - Global content search functionality
- Product Filtering - E-commerce product discovery
- Command Palettes - Quick action and navigation access
- Data Tables - Filtering large datasets
- User Selection - Finding and selecting users or items
- Documentation - Searching through help content
Best Practices
- Choose the Right Component - Match complexity to use case
- Provide Clear Placeholders - Help users understand what they can search for
- Show Search State - Loading indicators and result counts
- Handle Empty States - Provide helpful messages when no results found
- Keyboard Shortcuts - Consider adding keyboard shortcuts (Ctrl+K, /)
- Mobile Optimization - Ensure touch-friendly interactions
- Performance - Debounce search queries and optimize for large datasets
- Clear Actions - Provide easy ways to clear or reset searches