Components
Select
A custom listbox for choosing one value, with typeahead and keyboard navigation.
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 selectAdds components/ui/select.tsx and installs react, @radix-ui/react-popover, @radix-ui/react-select, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
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 {
Select, SelectTrigger, SelectValue, SelectContent, SelectItem,
} from '@/components/ui/select'
export function RolePicker() {
return (
<Select defaultValue="designer">
<SelectTrigger aria-label="Role"><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value="designer">Designer</SelectItem>
<SelectItem value="engineer">Engineer</SelectItem>
<SelectItem value="researcher" disabled hint="Seat limit">Researcher</SelectItem>
</SelectContent>
</Select>
)
}API and states
- API
- Select (multiple, value, defaultValue, onValueChange, name), SelectTrigger (size), SelectValue (chips when multiple), SelectContent (position), SelectGroup, SelectLabel, SelectItem (hint, icon), SelectSeparator
- Minimum states
- Open, highlighted, selected, disabled, invalid, focus
- Native basis
- Reviewed Radix select primitive
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.