npx gluestack-ui add selectimport {
Select,
SelectTrigger,
SelectInput,
SelectIcon,
SelectPortal,
SelectBackdrop,
SelectContent,
SelectDragIndicatorWrapper,
SelectDragIndicator,
SelectItem,
} from '@/components/ui/select';


export default () => (
<Select>
<SelectTrigger>
<SelectInput />
<SelectIcon as={IconComponent} />
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectDragIndicatorWrapper>
<SelectDragIndicator />
</SelectDragIndicatorWrapper>
<SelectItem />
</SelectContent>
</SelectPortal>
</Select>
);
| Prop | Type | Default | Description |
|---|---|---|---|
isDisabled | boolean | false | When true, the select is disabled and cannot be edited. |
isInvalid | boolean | false | When true, the select displays an error state. |
isRequired | boolean | false | When true, sets aria-required="true" on the input. |
isHovered | boolean | false | When true, the select displays a hover state. |
isFocusVisible | boolean | false | When true, the focus ring of select will be visible. |
isFocused | boolean | false | When true, the select displays a focus state. |
closeOnOverlayClick | boolean | false | When true, the select will close when the overlay is clicked. |
selectedValue | string | - | Sets the currently selected option value, allowing the component to render with the corresponding option pre-selected. |
initialLabel | string | - | Sets the initial selected Label for a select component. |
defaultValue | string | - | Sets the initial selected option value for a select component. |
onOpen | () => any | - | Callback to be invoked when Select Dropdown or Actionsheet is opened. |
onValueChange | () => any | - | Callback to be invoked when Select value is changed. |
onClose | () => any | - | Callback to be invoked when Select Dropdown or Actionsheet is closed. |
| Prop | Type | Default | Description |
|---|---|---|---|
isDisabled | bool | false | When true, its disabled state activates. |
label | string | - | setting label that displays to the user. |
value | string | - | The value to be used for the item. This is the value that will be returned on form submission. |
textStyle | inherits all the properties of react native text | - | This prop only works on native. |
| Name | Value | Default |
|---|---|---|
size | sm | md | lg | xl | md |
variant | underlined | outline | rounded | outline |
| State | Data Attribute | Values |
|---|---|---|
hover | data-hover | true | false |
disabled | data-disabled | true | false |
focus | data-focus | true | false |
invalid | data-invalid | true | false |