docs/components/native-select
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Styled native HTML select element.
PreviewCode
Select an optionBananaAppleOrangePineapple
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/native-select
NativeSelect
├── NativeSelectOption
└── NativeSelectOptGroup
└── NativeSelectOption
import {
NativeSelect,
NativeSelectOptGroup,
NativeSelectOption,
} from "@/components/ui/native-select";
<NativeSelect>
<NativeSelectOptGroup label="Group 1">
<NativeSelectOption value="1">Option 1</NativeSelectOption>
<NativeSelectOption value="2">Option 2</NativeSelectOption>
<NativeSelectOption value="3">Option 3</NativeSelectOption>
</NativeSelectOptGroup>
</NativeSelect>
Use the size prop to change the select height.
PreviewCode
Select an optionBananaAppleOrange
PreviewCode
Select an optionBananaAppleOrange
PreviewCode
Select an optionBananaAppleOrange
Use value and onChange to control the select externally.
PreviewCode
Select an optionBananaAppleOrange
Selected: —
Use the disabled prop to disable the select.
PreviewCode
Select an optionBananaAppleOrange
Use the invalid prop to mark the select as invalid.
PreviewCode
Select a fruit BananaAppleOrange
Use NativeSelectOptGroup to group options with a label.
PreviewCode
Select an optionBananaMangoPineappleCarrotPotatoTomato
Wrap in Field with FieldLabel and FieldDescription for proper labeling and accessibility.
PreviewCode
Country Select a countryBrazilMexicoIreland
Used for shipping estimates
Extends native <select> props. Additional props:
| Prop | Type | Default |
|---|---|---|
size | `"sm" | "md" |
disabled | boolean | - |
invalid | boolean | - |
Extends native <optgroup> props. Use label for the group label.
Extends native <option> props. Use value and children for option value and label.
For a complete list of props, see the Ark UI documentation.
[
Previous page
Menu ](/docs/components/menu)[
Next page
Number Input ](/docs/components/number-input)
On This Page
InstallationAnatomyUsageNative Select vs SelectSizesSmallMediumLargeStatesControlledDisabledInvalidExamplesGroupsWith FieldAPI ReferenceNativeSelectNativeSelectOptGroupNativeSelectOption