Components
Combobox (Autocomplete)
An input with a filtered list of suggestions, filtering included.
Installation
Install @vinui/react from GitHub with pnpm, then import its stylesheet once, in your root layout or entry file:
pnpm add github:vindotski/vinui#path:packages/react
import '@vinui/react/styles.css';
Usage
An autocomplete input built on Headless UI's Combobox. Pass the options and how to display them; filtering is handled for you:
import { Combobox, ComboboxOption } from '@vinui/react';
<Combobox
aria-label="Assignee"
placeholder="Search people…"
options={people}
displayValue={(person) => person?.name ?? ''}
value={person}
onChange={setPerson}
>
{(person) => <ComboboxOption value={person}>{person.name}</ComboboxOption>}
</Combobox>;
- Options are filtered by a case-insensitive match on
displayValue; passfilterto match differently (e.g. on email too). emptyMessageis shown when nothing matches (default "No results found").immediateopens the options on focus. Usebyfor object values andnameto submit with a form.invalidgives a red border and setsaria-invalid, like the other fields.
More to come
Detailed examples, keyboard interaction and the full component API are on their way.