Component to render select menu.
This component can be used either as a controlled component by passing both value
and onChange
props, or as an uncontrolled component.
When using as a controlled component, the defaultValue
can be provided to set the initial selected value.
This is a basic select menu which can render a label, a icon for an option. The component can take options in the form of OptionType
or string
.
The Select component can be imported using
import { Select } from '@tail-kit/tail-kit'
Name | Description | Default Value |
---|---|---|
defaultValue | The default selected value string | undefined | -- |
value | The value of the selected option. To be used in conjunction with `onChange` when
using with select as a controlled component. string | undefined | -- |
onChange | Handler function called when the selected option is changed ((selectedOption: string | undefined) => void) | undefined | -- |
placeholder | Intial label in toggle button string | undefined | Select Option |
options | Options to render in dropdown (string | OptionType)[] | -- |
disabled | Disable select component boolean | undefined | -- |
allowClear | Show clear button to clear selection boolean | undefined | -- |
className | Additional classes applied to the select component string | undefined | -- |
style | Additional styles applied to the select component CSSProperties | undefined | -- |
portalParent | parent of the portal container rendering the menu HTMLElement | undefined | -- |