Blossom UI

Combobox

Combobox component, a searchable select with filtering, descriptions, icons, custom values, server search and keyboard navigation.

How to use it

Run npx @blossomui/react add combobox, or copy src/components/UI/Combobox/Combobox.tsx into your React project and import it.

import { Combobox } from './components/ui/Combobox'

Props

ComboboxOption

PropTypeDescription
value (required)string
label (required)string
descriptionstringSecond line under the label, for example an email.
iconReactNodeElement shown before the label, for example an avatar or an icon.
disabledboolean

ComboboxLabels

PropTypeDescription
empty (required)stringText shown when nothing matches what was typed.
clear (required)stringAccessible name of the button that clears the value.
toggle (required)stringAccessible name of the button that opens the list.
create (required)(text: string) => stringText of the option that creates a new value, with `allowCustom`.

ComboboxProps

PropTypeDescription
labelsPartial<ComboboxLabels>Texts of the component. Pass only the ones you want to change, for example to translate it.
requiredbooleanMarks the field as required: an asterisk is shown next to the label.
colorstringAccent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default.
labelstring
hintstringHelper text shown under the field.
errorstringError message. Turns the field red.
successstringSuccess message. Turns the field green.
options (required)ComboboxOption[]
valuestringControlled value (the `value` of an option, or the typed text with `allowCustom`). Use together with `onChange`.
defaultValuestringInitial value when the field is not controlled.
onChange(value: string) => voidCalled with the `value` of the chosen option, or an empty string when the field is cleared.
onInputChange(text: string) => voidCalled every time the user types, useful to search on a server.
placeholderstring
allowCustombooleanLet the user keep a text that is not in the list. It is offered as the last option.
clearablebooleanShow a button that clears the value.
filter((option: ComboboxOption, text: string) => boolean) | falseOwn filter. By default the options that contain the typed text are shown, ignoring case and accents. Pass `false` to show all of them, for example when you filter on a server.
namestringAdds a hidden input with this name so the value is sent with native forms.
disabledboolean

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree