Forms
Select
One value from a list. It opens over its trigger, finds an option as you type, and works from the keyboard alone.
Forms
One value from a list. It opens over its trigger, finds an option as you type, and works from the keyboard alone.
Change the props on the right. The select and its code follow.
import { Label } from 'omuk-ui/label';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from 'omuk-ui/select';
<Label htmlFor={id}>Region</Label>
<Select items={REGIONS} value={region} onValueChange={setRegion}>
<SelectTrigger id={id} className="w-full">
<SelectValue placeholder="Choose a region" />
</SelectTrigger>
<SelectContent>
{REGIONS.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>Give the options to items too: the trigger then shows the chosen option’s label, and typing finds an option by it.
items takes groups as well, each with its own items. A label names each group; a separator splits them.
Select is the root; the trigger, the list and the options are its parts.