Select
Display a dropdown list of items.
Import
import { Select } from 'raw-ui';
Default
Types
Sizes
Selected
Controlled
Multiple
Clearable
Disabled select
Disabled option
Set parent element
API
Select
| Prop | Description | Type | Default |
|---|
| type | select type | 'default' | 'warning' | 'error' | 'default' |
| size | select size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| defaultValue | default selected value (uncontrolled) | SelectValue | - |
| value | selected value (controlled) | SelectValue | - |
| placeholder | select placeholder | string | - |
| width | select width | string | '100%' |
| disabled | disable select | boolean | false |
| multiple | support multiple selection | boolean | false |
| clearable | whether to show the clear icon | boolean | false |
| strategy | The positioning strategy of popup | 'absolute' | 'fixed' | 'absolute' |
| onChange | change event handler | (value: SelectValue) => void | - |
| getPopupContainer | set the parent element of popup rendering | () => HTMLElement | null | - |
| ... | native props | React.HTMLAttributes | - |
Select.Option
| Prop | Description | Type | Default |
|---|
| value | unique identification value | string | number | - |
| disabled | disable current option | boolean | false |
| ... | native props | React.HTMLAttributes | - |
Type
import { SelectOptionValue, SelectValue } from 'raw-ui';
SelectOptionValue
type SelectOptionValue = string | number | undefined;
SelectValue
type SelectValue = SelectOptionValue | SelectOptionValue[] | undefined;