Search bar
Search bar
Component demo
Interactive example
<ic-search-barlabel="What is your favourite coffee?"placeholder="Start typing to search…"></ic-search-bar>
Search bar details
Props
All components also accept native properties supported by the DOM, such asclassName
and
style
.
|
|
|
---|---|---|
|
The label for the search bar. |
|
|
The hint text for the hidden assistive description element. |
|
|
The automatic capitalisation of the text value as it is entered/edited by the user. Available options: "off", "none", "on", "sentences", "words", "characters". |
|
|
The state of autocompletion the browser can apply on the text value. |
|
|
The state of autocorrection the browser can apply when the user is entering/editing the text value. |
|
|
If |
|
|
The number of characters until suggestions appear. The submit button will be disabled until the inputted value is equal to or greater than this number. |
|
|
The amount of time, in milliseconds, to wait to trigger the |
|
|
Specify whether to disable the built in filtering. For example, if options will already be filtered from external source.
If |
|
|
If |
|
|
The text displayed when there are no options in the option list. |
|
|
If |
|
|
Specify whether the search bar fills the full width of the container.
If |
|
|
The helper text that will be displayed for additional field guidance. |
|
|
If |
|
|
The custom name for the label field to correspond with the IcMenuOption type. |
|
|
Trigger loading state when fetching options asynchronously |
|
|
Change the message displayed when external loading times out. |
|
|
Change the message displayed whilst the options are being loaded externally. |
|
|
The name of the control, which is submitted with the form data. |
|
|
The suggested search options. |
|
|
The placeholder value to display. |
|
|
If |
|
|
If |
|
|
If |
|
|
Specify the mode search bar uses to search. |
|
|
The size of the search bar component. |
|
|
If |
|
|
Sets the theme color to the dark or light theme color. "inherit" will set the color based on the system settings or ic-theme component. |
|
|
If using external filtering, set a timeout for when loading takes too long. |
|
|
The value of the search input. |
|
|
The custom name for the value field to correspond with the IcMenuOption type. |
|
The label for the search bar. |
The hint text for the hidden assistive description element. |
The automatic capitalisation of the text value as it is entered/edited by the user. Available options: "off", "none", "on", "sentences", "words", "characters". |
The state of autocompletion the browser can apply on the text value. |
The state of autocorrection the browser can apply when the user is entering/editing the text value. |
If |
The number of characters until suggestions appear. The submit button will be disabled until the inputted value is equal to or greater than this number. |
The amount of time, in milliseconds, to wait to trigger the |
Specify whether to disable the built in filtering. For example, if options will already be filtered from external source.
If |
If |
The text displayed when there are no options in the option list. |
If |
Specify whether the search bar fills the full width of the container.
If |
The helper text that will be displayed for additional field guidance. |
If |
The custom name for the label field to correspond with the IcMenuOption type. |
Trigger loading state when fetching options asynchronously |
Change the message displayed when external loading times out. |
Change the message displayed whilst the options are being loaded externally. |
The name of the control, which is submitted with the form data. |
The suggested search options. |
The placeholder value to display. |
If |
If |
If |
Specify the mode search bar uses to search. |
The size of the search bar component. |
If |
Sets the theme color to the dark or light theme color. "inherit" will set the color based on the system settings or ic-theme component. |
If using external filtering, set a timeout for when loading takes too long. |
The value of the search input. |
The custom name for the value field to correspond with the IcMenuOption type. |
Slots
A slot allows for any type of element or markup to be passed into and rendered within a web component. This creates more flexibility than using a prop which must take a specific type of data.
Content can be slotted into a component by adding it as a top-level child of the component.
Slots can have a name to identify them. These specify which slot the content will be inserted into, and therefore where it will be rendered and how it will be used within the component. The name of the slot to be used can be specified by passing it via a
slot
attribute on the slotted content.
|
|
---|---|
|
|
|
CSS Custom Properties
|
|
---|---|
|
|
|
Events
All components also accept native events supported by the DOM, such as
onClick
and
onKeyDown
.
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods
|
|
|
---|---|---|
|
|
|
|
Variants
With options (no filtering)
Interactive example
<ic-search-barplaceholder="Start typing to search…"label="What is your favourite coffee?"disable-auto-filtering="true"></ic-search-bar><br><ic-typography><p>All options will be displayed as you type</p></ic-typography>
With helper text
Interactive example
<ic-search-barplaceholder="Start typing to search…"label="What is your favourite coffee?"helper-text="Coffee options will be displayed as you type."></ic-search-bar>
With hidden label
Interactive example
<ic-search-barplaceholder="Start typing to search…"label="What is your favourite coffee?"hide-label="true"></ic-search-bar>
Disabled
Interactive example
<ic-search-barlabel="What is your favourite coffee?"disabled="true"></ic-search-bar>
Size small
Interactive example
<ic-search-barlabel="What is your favourite coffee?"size="small"></ic-search-bar>
Theme
Interactive example
<ic-search-barlabel="What is your favourite coffee?"placeholder="Start typing to search…"theme="dark"></ic-search-bar>
Custom filtering example
This example shows how to filter data asynchronously when the value in the input field changes. The data is mocked and displayed after a one second delay, but could be replaced with a call to an API or database.
Interactive example
<ic-search-barplaceholder="Start typing to search…"label="What is your favourite coffee?"debounce="300"disable-auto-filtering="true"></ic-search-bar>