A bare select control (built on Radix's `Select`) — the Radix trigger button is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome.
Examples of v0.6.2 are shown as code; only the latest version runs live. Open the live examples →
Basic Select
1const colorOptions = [2 { label: "Red", value: "red" },3 { label: "Green", value: "green" },4 { label: "Blue", value: "blue" },5];67const BasicSelect = () => {8 const [value, setValue] = useState("");9 return (10 <Select11 placeholder="Choose a color"12 options={colorOptions}13 value={value}14 onValueChange={setValue}15 />16 );17};1819render(<BasicSelect />);
Select With Form Field
1const roleOptions = [2 { label: "Admin", value: "admin" },3 { label: "Editor", value: "editor" },4 { label: "Viewer", value: "viewer" },5 { label: "Guest (disabled)", value: "guest", disabled: true },6];78const SelectWithFormField = () => {9 const [value, setValue] = useState("");10 return (11 <FormField12 label="Role"13 htmlFor="role"14 hint="Determines what the user can access."15 >16 <Select17 id="role"18 placeholder="Select a role"19 options={roleOptions}20 value={value}21 onValueChange={setValue}22 />23 </FormField>24 );25};2627render(<SelectWithFormField />);
Select With Error
1const colorOptions = [2 { label: "Red", value: "red" },3 { label: "Green", value: "green" },4 { label: "Blue", value: "blue" },5];67const SelectWithError = () => (8 <FormField label="Status" htmlFor="status" error="Please select a status.">9 <Select10 id="status"11 invalid12 placeholder="Select status"13 options={colorOptions}14 />15 </FormField>16);1718render(<SelectWithError />);
Disabled Select
1const colorOptions = [2 { label: "Red", value: "red" },3 { label: "Green", value: "green" },4 { label: "Blue", value: "blue" },5];67const DisabledSelect = () => (8 <Select disabled options={colorOptions} value="red" />9);1011render(<DisabledSelect />);