Combobox
FormsFilters a list of options through text input and stores one selected value.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/combobox.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes typography. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/combobox.json https://luv-jeri.github.io/cojeev-ui/r/typography.jsonUsing combobox
Items show stable, varied blob adornments by default. Set adornment={false} to hide, supply {shape,color,icon,effect}, or pass a custom icon element.
Provide options with distinct values and readable labels for the built-in input, results, and empty state.
Use value and onValueChange to store the selection, or compose the input and item parts for custom option content.
ComboboxItem shows a persistent selected check separately from hover or keyboard emphasis. Set showIndicator=false to suppress that mark.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
ComboboxProps
| Prop | Type | Required |
|---|---|---|
aria-labelDefines a string value that labels the current element. | string | undefined | No |
value | string | No |
defaultValue | string | No |
onValueChange | (value: string) => void | No |
open | boolean | No |
defaultOpen | boolean | No |
onOpenChange | (open: boolean) => void | No |
options | ComboboxOption[] | No |
placeholder | string | No |
emptyText | string | No |
ComboboxInputProps
| Prop | Type | Required |
|---|---|---|
wrapperProps | React.ComponentProps<typeof InputWrapper> | No |
leading | React.ReactNode | No |
ComboboxContentProps
Accepts the native or primitive props declared by its exported TypeScript type.
ComboboxItemProps
| Prop | Type | Required |
|---|---|---|
label | string | No |
showIndicator | boolean | No |
ComboboxEmptyProps
Accepts the native or primitive props declared by its exported TypeScript type.
ComboboxGroupProps
Accepts the native or primitive props declared by its exported TypeScript type.
Accessibility
Supply a specific aria-label for the input and preserve the input, list, and item parts that coordinate focus and selection.
Write a useful emptyText message when a search has no matching option.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.