BNA

BNA UI
26

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
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.

PropertyTypeDefaultDescription
labelstring-Display text for the option.
valuestring-Unique value for the option.
descriptionstring-Optional description text.
disabledboolean-Whether the option is disabled.

PickerSection

Interface for grouping options into sections.

PropertyTypeDefaultDescription
titlestring-Optional section title.
optionsPickerOption[]-Array of options in section.

Accessibility

The Picker component is built with accessibility in mind:

  • Uses Modal component for proper focus management
  • Supports keyboard navigation within the modal
  • Provides proper touch targets for mobile devices
  • Uses semantic color contrast for text and backgrounds
  • Supports screen reader announcements