GitHub

Select

A component that displays a select dropdown.

Installation#

Usage#

import {
Select,
SelectContent,
SelectDescription,
SelectErrorMessage,
SelectHiddenSelect,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "~/components/ui/select";
<Select
value={value()}
onChange={setValue}
options={["Apple", "Banana", "Blueberry", "Grapes", "Pineapple"]}
placeholder="Select a fruit…"
itemComponent={(props) => (
<SelectItem item={props.item}>{props.item.rawValue}</SelectItem>
)}
>
<SelectTrigger aria-label="Fruit" class="w-[180px]">
<SelectValue<string>>{(state) => state.selectedOption()}</SelectValue>
</SelectTrigger>
<SelectContent />
</Select>