Skip to content
ChibiUI

Built on Radix UI Select

Select

A custom-styled listbox with groups, separators and disabled options. It submits natively inside forms.

Playground

Generated code
import { ChibiSelect, ChibiSelectItem } from '@chibi-ui/react/select';

<ChibiSelect label="Favourite flavour" placeholder="Pick a flavour">
  <ChibiSelectItem value="strawberry">Strawberry</ChibiSelectItem>
  <ChibiSelectItem value="peach">Peach</ChibiSelectItem>
  <ChibiSelectItem value="matcha">Matcha</ChibiSelectItem>
</ChibiSelect>

Import

TSX
import {
  ChibiSelect,
  ChibiSelectItem,
  ChibiSelectGroup,
  ChibiSelectLabel,
  ChibiSelectSeparator,
} from '@chibi-ui/react/select';

Examples

react-hook-form Controller
<Controller
  control={control}
  name="flavour"
  render={({ field }) => (
    <ChibiSelect
      label="Flavour"
      placeholder="Pick one"
      error={errors.flavour?.message}
      value={field.value}
      onValueChange={field.onChange}
      onBlur={field.onBlur}
      ref={field.ref} // lets RHF focus the trigger on error
      name={field.name}
    >
      <ChibiSelectItem value="strawberry">Strawberry</ChibiSelectItem>
      <ChibiSelectItem value="matcha">Matcha</ChibiSelectItem>
    </ChibiSelect>
  )}
/>

Accessibility

  • The trigger is a labelled combobox button. ref points at it, so react-hook-form can focus it when validation fails.
  • Typeahead plus arrow, Home and End keys. Disabled options are skipped.
  • The highlighted option gets an outline as well as a tint, so it meets non-text contrast.
  • A hidden native <select> mirrors the value, so plain form submission works.

API reference

ChibiSelect

PropTypeDefaultDescription
labelReactNodeโ€”Visible label, associated with the control.
descriptionReactNodeโ€”Helper text, linked via aria-describedby.
errorReactNodeโ€”Error message (e.g. errors.x?.message). Any truthy value sets aria-invalid; true marks invalid without a message.
containerClassNamestringโ€”Class for the wrapper holding label, control and messages.
placeholderReactNodeโ€”Shown when empty.
value / defaultValuestringโ€”Controlled / uncontrolled value.
onValueChange(value: string) => voidโ€”Selection callback.
name / required / disabledโ€ฆโ€”Native form semantics.
size'sm' | 'md' | 'lg''md'Trigger height.
refRef<HTMLButtonElement>โ€”Forwarded to the trigger.