Search
Search
Go to top
Also see /react/input#search
Styling the React Input component
Also see /react/nav#search-input
Search input for Nav component
Search with button
- Suitable for big/slow server-side search.
- Click search button to perform search with
onIconClick. - Trigger on Enter key with
onKeyPress. - If a new search is performed, overwrite results from the previous request.
- When search field is empty, do nothing on button click / Enter.
Live filter
- Suitable when you already have the full dataset available locally.
- Result list is updated immediately while typing so there no need to press enter, have a search button, or a loading spinner.
- If there is a large dataset (makes the filtering slow), consider using a debounce so you don't risk locking the UI while the user is typing.
Examples source code
View source code for the examples above in GitHub (requires authentication)
Global search hotkey
If you have an app-global search (in topbar, for example) it should be focusable using:
⌘ + Kon macOSCtrl + Kon Windows/Linux.
Also see /react/useHotkey
React hook