Native select
npx shadcn add @klarhimmel/native-select @klarhimmel/inputCopy for AIExamples
Basic
Form
States
DetailsAbout, usage, props and more
The browser's own select in the system's field style. Best on phones and for short lists.
When to use
Use for
One value from a short, fixed list, especially on phones.
Not for
Long searchable lists, or options with icons.
Pairs with
Field, forms and filters.
Preview
You can change this later.
Import
Import
- Files
- native-select.tsx, input.tsx, in components/klarhimmel/ui/. With it: button, editing, theme, utils. npm: lucide-react.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
invalid | boolean | - | Sets aria-invalid and the danger border. |
native attributes | SelectHTMLAttributes | - | Every native attribute of the element passes through, className included. |
Accessibility
| Key | Does |
|---|---|
Space / Enter / Up / Down | Opens the browser's picker |
Type a letter | Jumps to a matching option |
The browser draws the open list, so it is always accessible and always native.
Accessibility