Components
Native Select
Styles the browser's own select control.
Ombelle · light
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add native-selectAdds components/ui/native-select.tsx and installs react, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { Label } from '@/components/ui/label'
import {
NativeSelect, NativeSelectOptGroup, NativeSelectOption,
} from '@/components/ui/native-select'
export function RegionField() {
return (
<>
<Label htmlFor="region">Region</Label>
<NativeSelect id="region" name="region" defaultValue="eu">
<NativeSelectOptGroup label="Europe">
<NativeSelectOption value="eu">European Union</NativeSelectOption>
<NativeSelectOption value="uk">United Kingdom</NativeSelectOption>
</NativeSelectOptGroup>
<NativeSelectOption value="us">United States</NativeSelectOption>
</NativeSelect>
</>
)
}API and states
- API
- NativeSelect, NativeSelectOption, NativeSelectOptGroup, native select props
- Minimum states
- Default, selected, focus, invalid, disabled
- Native basis
- <select>
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.