Select
The Select component provides a dropdown listbox interface, consisting of multiple SelectItem components. This component enables users to select an option or perform an action. Each SelectItem within the Select component represents an individual list item, ensuring consistent adherence to the defined menu style.
Usage Guide
The Select component allows users to choose an option from a dropdown list. Below is an example of its basic usage:
Item One
Item Two
Item Three
<Select> <SelectItem id="one">Item One</SelectItem> <SelectItem id="two">Item Two</SelectItem> <SelectItem id="three">Item Three</SelectItem></Select>Filterable Select
The Select component can also be made filterable by setting the filterable prop to true. This allows users to search through the options.
Item One
Item Two
Item Three
<Select filterable> <SelectItem id="one">Item One</SelectItem> <SelectItem id="two">Item Two</SelectItem> <SelectItem id="three">Item Three</SelectItem></Select>Props
Select Props
Optional class name to apply to the Select.
If true, the select is filterable.
The options to be displayed in the select.
The label for the select.
Hide the label visually.
Optional props to pass to the popover.
Callback function that is called when the selection changes.
Provides content to display when there are no items in the list. *
Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.
The list of ComboBox items (controlled).
Whether the input can be selected but not changed by the user.
Whether the input is disabled.
Describes the type of autocomplete functionality the input should provide if any. See MDN.
The name of the input, used when submitting an HTML form. The name of the input element, used when submitting an HTML form. See MDN.
The <form> element to associate the input with.
The value of this attribute must be the id of a <form> in the same document.
See MDN.
Whether single or multiple selection is enabled.
The currently selected key in the collection (controlled). @deprecated
The initial selected key in the collection (uncontrolled). @deprecated
Sets the open state of the menu.
Sets the default open state of the menu.
Method that is called when the open state of the menu changes. Method that is called when the open state of the menu changes. Returns the new open state and the action that caused the opening of the menu.
The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.
The current value (controlled).
The default value (uncontrolled).
Handler that is called when the value changes.
Whether user input is required on the input before form submission.
Whether the input value is invalid.
A function that returns an error message if a given value is invalid.
Validation errors are displayed to the user when the form is submitted
if validationBehavior="native". For realtime validation, use the isInvalid
prop instead.
Temporary text that occupies the select when it is empty.
Whether the element should receive focus on render.
Handler that is called when the element receives focus.
Handler that is called when the element loses focus.
Handler that is called when the element's focus status changes.
Handler that is called when a key is pressed.
Handler that is called when a key is released.
The element's unique identifier. See MDN.
Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
Whether keyboard navigation is circular.
The list of ComboBox items (uncontrolled).
The value of the ComboBox input (controlled).
The default value of the ComboBox input (uncontrolled).
Handler that is called when the ComboBox input value changes.
Whether the ComboBox allows a non-item matching input value to be set.
The interaction required to display the ComboBox menu.
The inline style for the element. A function may be provided to compute the style based on component state.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null value indicates that the local props completely override all props received from a parent.
The filter function used to determine if a option should be included in the combo box list.
Whether the text or key of the selected item is submitted as part of an HTML form.
When allowsCustomValue is true, this option does not apply and the text is always submitted.
Whether the combo box allows the menu to be open when the collection is empty.
SelectItem Props
The unique id of the item.
The object value that this item represents. When using dynamic collections, this is set automatically.
A string representation of the item's contents, used for features like typeahead.
Whether the item is disabled.
Handler that is called when a user performs an action on the item. The exact user event depends on
the collection's selectionBehavior prop and the interaction modality.
The children of the component. A function may be provided to alter the children based on component state.
The CSS className for the element. A function may be provided to compute the class based on component state.
The inline style for the element. A function may be provided to compute the style based on component state.
A URL to link to. See MDN.
Hints at the human language of the linked URL. SeeMDN.
The target window for the link. See MDN.
The relationship between the linked resource and the current page. See MDN.
Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN.
A space-separated list of URLs to ping when the link is followed. See MDN.
How much of the referrer to send when following the link. See MDN.
Options for the configured client side router.
Handler that is called when a hover interaction starts.
Handler that is called when a hover interaction ends.
Handler that is called when the hover state changes.
Handler that is called when the press is released over the target.
Handler that is called when a press interaction starts.
Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
Handler that is called when the press state changes.
Handler that is called when a press is released over the target, regardless of whether it started on the target or not.
Not recommended – use onPress instead. onClick is an alias for onPress
provided for compatibility with other libraries. onPress provides
additional event details for non-mouse interactions.