<Select><SelectTrigger variant="outline" size="md"><SelectInput placeholder="Select option" /><SelectIcon mr="$3"><Icon as={ChevronDownIcon} /></SelectIcon></SelectTrigger><SelectPortal><SelectBackdrop /><SelectContent><SelectDragIndicatorWrapper><SelectDragIndicator /></SelectDragIndicatorWrapper><SelectItem label="UX Research" value="ux" /><SelectItem label="Web Development" value="web" /><SelectItemlabel="Cross Platform Development Process"value="Cross Platform Development Process"/><SelectItem label="UI Designing" value="ui" isDisabled={true} /><SelectItem label="Backend Development" value="backend" /></SelectContent></SelectPortal></Select>
import { Select } from '@darden/design-system';
export default () => (<Select><SelectTrigger><SelectInput /><SelectIcon><Icon /></SelectIcon></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 | boolean | false | 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 | boolean | false | 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. |
Sx Prop | Description |
---|---|
_icon | Prop to style SelectIcon Component |
_input | Prop to style SelectInput Component |
Sx Prop | Description |
---|---|
_sectionHeaderBackground | Prop to style SelectActionsheetSectionHeaderText Component |
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. |
Sx Prop | Description |
---|---|
_text | Prop to style SelectItemText Component |
Name | Value | Default |
---|---|---|
size | xl | lg | md | sm | md |
variant | underlined | outline | rounded | outline |
<FormControl isRequired isInvalid><FormControlLabel><FormControlLabelText>Choose your favorite color</FormControlLabelText></FormControlLabel><Select><SelectTrigger><SelectInput placeholder="Select option" /><SelectIcon mr="$3"><Icon as={ChevronDownIcon} /></SelectIcon></SelectTrigger><SelectPortal><SelectBackdrop /><SelectContent><SelectDragIndicatorWrapper><SelectDragIndicator /></SelectDragIndicatorWrapper><SelectItem label="Red" value="red" /><SelectItem label="Blue" value="blue" /><SelectItem label="Black" value="black" /><SelectItem label="Pink" value="pink" isDisabled={true} /><SelectItem label="Green" value="green" /></SelectContent></SelectPortal></Select><FormControlHelper><FormControlHelperText>You can only select one option</FormControlHelperText></FormControlHelper><FormControlError><FormControlErrorIcon as={AlertCircleIcon} /><FormControlErrorText>Mandatory field</FormControlErrorText></FormControlError></FormControl>