Combobox

CollapsibleCommand

A select you can type into to search the options.

Installation

pnpm add krz-ui

Usage

import { Combobox } from "krz-ui";
<Combobox
  label="Framework"
  placeholder="Select a framework"
  options={[
    { value: "next", label: "Next.js" },
    { value: "remix", label: "Remix" },
  ]}
  value={framework}
  onValueChange={setFramework}
  clearable
/>

API Reference

PropTypeDescription
optionsComboboxOption[]Options with value, label, description and disabled.
value / defaultValuestring | nullControlled or initial selection.
onValueChange(value: string | null) => voidCalled with the selected value, or null when cleared.
label / hint / errorReactNodeField label, helper text and error message.
emptyTextReactNodeShown when nothing matches.
clearablebooleanShow a button that clears the selection.
filter(option, query) => booleanCustom matching. Defaults to a case-insensitive contains.
size / disabled / name"sm" | "md" | "lg" / boolean / stringSize, disabled state, and a hidden form field name.
className / style / ref—className and style go on the whole field; ref and native input attributes go to the <input>. See Customization.
classNames{ label?, control?, input?, icon?, message?, clear?, list?, option?, empty? }Extra classes for inner parts.