@usevyre/react @usevyre/vue

Select

An accessible dropdown with keyboard navigation, controlled and uncontrolled modes, and per-option disabled state. Built from scratch — no native <select>.


Basic

import { Select } from "@usevyre/react";

const frameworks = [
  { value: "react", label: "React" },
  { value: "vue",   label: "Vue" },
  { value: "svelte",label: "Svelte", disabled: true },
];

// Uncontrolled
<Select options={frameworks} placeholder="Select framework" />

// Controlled
const [val, setVal] = useState("");
<Select
  options={frameworks}
  value={val}
  onChange={setVal}
  placeholder="Select framework"
/>

Sizes

import { Field, Select } from "@usevyre/react";

<Field label="Framework" htmlFor="fw" state="error" hint="Required.">
  <Select id="fw" options={frameworks} placeholder="Pick one" />
</Field>

Keyboard navigation

Space / Enter opens the listbox. move between options. Enter selects. Escape closes without selection.

Props

Props

Prop Type Default Description
options { value: string; label: string; disabled?: boolean }[] List of selectable options.
value string Controlled selected value.
defaultValue string Initial value (uncontrolled).
placeholder string Text shown when nothing is selected.
onChange (value: string) => void React only. Called when selection changes.
disabled boolean false Disables the select.
size "sm" | "md" | "lg" "md" Select height.
class / className string Additional CSS class.