- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Card
- Checkbox
- Collapsible
- Combobox
- Context Menu
- Date Picker (Lite)
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP (Lite)
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
A styled native HTML select element with consistent design system integration.
For a styled select component, see the Select component.
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
export default function NativeSelectDemo() {
return (
<NativeSelect>
<NativeSelectOption value="">Select status</NativeSelectOption>
<NativeSelectOption value="todo">Todo</NativeSelectOption>
<NativeSelectOption value="in-progress">In Progress</NativeSelectOption>
<NativeSelectOption value="done">Done</NativeSelectOption>
<NativeSelectOption value="cancelled">Cancelled</NativeSelectOption>
</NativeSelect>
)
}Installation
pnpm dlx shadcnui-hono-jsx@latest add native-selectnpx shadcnui-hono-jsx@latest add native-selectyarn dlx shadcnui-hono-jsx@latest add native-selectbunx shadcnui-hono-jsx@latest add native-selectUsage
import {
NativeSelect,
NativeSelectOptGroup,
NativeSelectOption,
} from "@/components/ui/native-select"<NativeSelect>
<NativeSelectOption value="">Select a fruit</NativeSelectOption>
<NativeSelectOption value="apple">Apple</NativeSelectOption>
<NativeSelectOption value="banana">Banana</NativeSelectOption>
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
<NativeSelectOption value="pineapple">Pineapple</NativeSelectOption>
</NativeSelect>Composition
Simple
Options placed directly under NativeSelect (no NativeSelectOptGroup).
NativeSelect
├── NativeSelectOption
├── NativeSelectOption
├── NativeSelectOption
└── NativeSelectOptionWith groups
Use NativeSelectOptGroup to organize options into categories.
NativeSelect
├── NativeSelectOptGroup
│ ├── NativeSelectOption
│ └── NativeSelectOption
└── NativeSelectOptGroup
├── NativeSelectOption
└── NativeSelectOptionGroups
Use NativeSelectOptGroup to organize options into categories.
import {
NativeSelect,
NativeSelectOptGroup,
NativeSelectOption,
} from "@/components/ui/native-select"
export default function NativeSelectGroups() {
return (
<NativeSelect>
<NativeSelectOption value="">Select department</NativeSelectOption>
<NativeSelectOptGroup label="Engineering">
<NativeSelectOption value="frontend">Frontend</NativeSelectOption>
<NativeSelectOption value="backend">Backend</NativeSelectOption>
<NativeSelectOption value="devops">DevOps</NativeSelectOption>
</NativeSelectOptGroup>
<NativeSelectOptGroup label="Sales">
<NativeSelectOption value="sales-rep">Sales Rep</NativeSelectOption>
<NativeSelectOption value="account-manager">
Account Manager
</NativeSelectOption>
<NativeSelectOption value="sales-director">
Sales Director
</NativeSelectOption>
</NativeSelectOptGroup>
<NativeSelectOptGroup label="Operations">
<NativeSelectOption value="support">
Customer Support
</NativeSelectOption>
<NativeSelectOption value="product-manager">
Product Manager
</NativeSelectOption>
<NativeSelectOption value="ops-manager">
Operations Manager
</NativeSelectOption>
</NativeSelectOptGroup>
</NativeSelect>
)
}Disabled
Add the disabled prop to the NativeSelect component to disable the select.
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
export function NativeSelectDisabled() {
return (
<NativeSelect disabled>
<NativeSelectOption value="">Disabled</NativeSelectOption>
<NativeSelectOption value="apple">Apple</NativeSelectOption>
<NativeSelectOption value="banana">Banana</NativeSelectOption>
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
</NativeSelect>
)
}Invalid
Use aria-invalid to show validation errors and the data-invalid attribute to the Field component for styling.
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
export function NativeSelectInvalid() {
return (
<NativeSelect aria-invalid="true">
<NativeSelectOption value="">Error state</NativeSelectOption>
<NativeSelectOption value="apple">Apple</NativeSelectOption>
<NativeSelectOption value="banana">Banana</NativeSelectOption>
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
</NativeSelect>
)
}Native Select vs Select
- Use
NativeSelectfor native browser behavior, better performance, or mobile-optimized dropdowns. - Use
Selectfor custom styling, animations, or complex interactions.
RTL
To enable RTL support in shadcn/ui, see the RTL configuration guide.
// This example sets dir and uses useTranslation because this site is not RTL.
// In an RTL app you won't need them; see the RTL guide.
import {
type Translations,
useTranslation,
} from "@/components/language-selector"
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
const translations: Translations = {
en: {
dir: "ltr",
values: {
placeholder: "Select status",
todo: "Todo",
inProgress: "In Progress",
done: "Done",
cancelled: "Cancelled",
},
},
ar: {
dir: "rtl",
values: {
placeholder: "اختر الحالة",
todo: "مهام",
inProgress: "قيد التنفيذ",
done: "منجز",
cancelled: "ملغي",
},
},
he: {
dir: "rtl",
values: {
placeholder: "בחר סטטוס",
todo: "לעשות",
inProgress: "בתהליך",
done: "הושלם",
cancelled: "בוטל",
},
},
}
export function NativeSelectRtl() {
const { dir, t } = useTranslation(translations, "ar")
return (
<NativeSelect dir={dir}>
<NativeSelectOption value="">{t.placeholder}</NativeSelectOption>
<NativeSelectOption value="todo">{t.todo}</NativeSelectOption>
<NativeSelectOption value="in-progress">
{t.inProgress}
</NativeSelectOption>
<NativeSelectOption value="done">{t.done}</NativeSelectOption>
<NativeSelectOption value="cancelled">{t.cancelled}</NativeSelectOption>
</NativeSelect>
)
}Notes
- Accepts
classinstead ofclassName. - Upstream documentation: shadcn/ui Native Select. See also Differences from shadcn/ui.
API Reference
NativeSelect
The main select component that wraps the native HTML select element.
<NativeSelect>
<NativeSelectOption value="option1">Option 1</NativeSelectOption>
<NativeSelectOption value="option2">Option 2</NativeSelectOption>
</NativeSelect>NativeSelectOption
Represents an individual option within the select.
| Prop | Type | Default |
|---|---|---|
value | string | |
disabled | boolean | false |
NativeSelectOptGroup
Groups related options together for better organization.
| Prop | Type | Default |
|---|---|---|
label | string | |
disabled | boolean | false |
<NativeSelectOptGroup label="Fruits">
<NativeSelectOption value="apple">Apple</NativeSelectOption>
<NativeSelectOption value="banana">Banana</NativeSelectOption>
</NativeSelectOptGroup>