Overview
TheSearchInput component renders an input field that allows users to type a search query. It handles user interactions, emits relevant events, and integrates seamlessly with other search components in the Interface X library.
Installation
Import theSearchInput component from the search-box module:
Props
Maximum characters allowed in the search input.
Enables automatic focus when the search field is rendered.
Enables auto-accept query after debounce period.
Debounce time in milliseconds for the instant search feature.
Events
The component emits the following events:UserClickedSearchBox- Emitted when the user clicks the search inputUserBlurredSearchBox- Emitted when the search box loses focusUserFocusedSearchBox- Emitted when the search box gains focusUserIsTypingAQuery- Emitted when the user types or pastes into the search boxUserPressedEnterKey- Emitted when the user presses EnterUserPressedArrowKey- Emitted when the user presses an arrow keyUserAcceptedAQuery- Emitted when a query is accepted (Enter key or after debounce)UserHoveredInSearchBox- Emitted when the search box is hoveredUserHoveredOutSearchBox- Emitted when hover leaves the search box
Basic Usage
Here’s a simple example of using the SearchInput component:Customized Example
Customize the behavior with props:Complete Search Box
Combine with other components for a full search experience:Handling Events
Listen to events to create interactive experiences:The SearchInput component automatically prevents special characters like
< and > from being entered.Related Components
Search Module
Search module API reference
QuerySuggestions
Display autocomplete suggestions
