useTypeahead — Type to Focus a Country
- from @astryx
- by Astryx
A country list of buttons with useListFocus arrow keys and useTypeahead type-to-focus. Typing "can" focuses Canada, pressing "b" again and again cycles through Belgium, Brazil and Bulgaria, and "e" finds Éire with the accent ignored. The hook only reports the match through onMatch, and useListFocus moves focus.
Install
New to shadcn? Set up your project
If your project already has a shadcn components.json, skip initialization. Otherwise, run this once from your project root.
pnpm dlx shadcn@latest initpnpm dlx shadcn@latest add @astryx/example-use-typeahead-type-to-focus-a-countryRegistry dependencies0
The CLI adds no other registry items with this one.
