radkradk

Combobox

Autocomplete input and command palette with filtering.

Installation

npx radk-cli@latest add combobox

Usage

import { Combobox } from "@/components/ui/combobox"
const options = [
  { value: "next.js", label: "Next.js" },
  { value: "react", label: "React" },
]

const [value, setValue] = React.useState("")

<Combobox
  options={options}
  value={value}
  onValueChange={setValue}
  placeholder="Select a framework..."
/>

Props

PropTypeDefault
options{ value: string; label: string }[]Required
valuestring
onValueChange(value: string) => void
placeholderstring"Select an option..."
searchPlaceholderstring"Search..."
emptyMessagestring"No results found."
classNamestring