Picker

PreviousNext

A customizable dropdown picker component with search, sections, and multiple selection support.

Installation

pnpm dlx bna-ui add picker

Usage

import { Picker } from '@/components/ui/picker';
<Picker
  options={[
    { label: 'Option 1', value: '1' },
    { label: 'Option 2', value: '2' },
    { label: 'Option 3', value: '3' },
  ]}
  value={selectedValue}
  onValueChange={setSelectedValue}
  placeholder='Select an option...'
/>

Examples

Default

With Sections

Multiple Selection

Searchable

With Icons and Labels

Variants

Form Integration

Advanced Features

API Reference

Picker

The main picker component that displays options in a modal.

PropTypeDefaultDescription
hapticbooleantrueWhether to trigger haptic feedback when the picker opens and when an option is selected.
optionsPickerOption[][]Array of options to display.
sectionsPickerSection[][]Array of sections containing grouped options.
valuestring-Currently selected value (single selection).
valuesstring[][]Currently selected values (multiple selection).
placeholderstring"Select an option..."Placeholder text when no option is selected.
errorstring-Error message to display.
variant"outline" | "filled" | "group""filled"Visual variant of the picker.
onValueChange(value: string) => void-Callback when single selection changes.
onValuesChange(values: string[]) => void-Callback when multiple selection changes.
disabledbooleanfalseWhether the picker is disabled.
multiplebooleanfalseEnable multiple selection mode.
labelstring-Label text to display.
iconReact.ComponentType<LucideProps>-Icon component to display.
rightComponentReactNode | (() => ReactNode)-Custom component to display on the right side.
modalTitlestring-Title for the modal header.
searchablebooleanfalseEnable search functionality.
searchPlaceholderstring"Search options..."Placeholder for search input.
styleViewStyle-Additional styles for the picker container.
inputStyleTextStyle-Additional styles for the input text.
labelStyleTextStyle-Additional styles for the label text.
errorStyleTextStyle-Additional styles for the error text.

PickerOption

Interface for individual picker options.

PropTypeDescription
labelstringDisplay text for the option.
valuestringUnique value for the option.
descriptionstringOptional description text.
disabledbooleanWhether the option is disabled.

PickerSection

Interface for grouping options into sections.

PropTypeDescription
titlestringOptional section title.
optionsPickerOption[]Array of options in section.

Accessibility

  • Option rows expose accessibilityRole="menuitem" and accessibilityState={{ selected, disabled }} so screen readers announce selection state
  • Uses Modal for the options sheet, which traps interaction within it while open
  • The trigger meets the 44×44 minimum touch target on all variants