Bonusway design system

Forms

Dropdown

A custom select with an optional search box. For a list long enough that scanning it is the problem — a country list, a store list. Everything shorter should be a Select.

import Dropdown from '@/components/ui/Dropdown';

Source: src/components/ui/Dropdown.tsx

Examples

Plain and searchable

interactive

size="sm"

Props

<Dropdown> props

PropTypeDefaultDescription
optionsrequiredDropdownOption[]——
valuestring——
onChange(value: string) => void——
placeholderstring'Select Options'—
searchablebooleanfalse

Renders the style guide's "searchable" variant: an input that filters the menu while typing.

disabledbooleanfalse—
size'sm' | 'md''md'—
classNamestring''—
idstring—

Applied to the field element (the input when searchable, the button otherwise) so `Field` can wire its label to it — Field clones its child with an `id` and `aria-describedby`, which a component that doesn't accept them silently drops, leaving a label that points at nothing.

Usage

Do

  • Turn on `searchable` once the list passes about ten options.

Don’t

  • Don’t use it for a short list. A native Select is better on every phone.
  • Don’t use it for actions — that is a Menu.

Related:SelectMenu

Šī lapa lieto sīkfailus

Mēs izmantojam sīkfailus, lai uzlabotu tavu pieredzi mūsu vietnē un pielāgotu saturu, ko mēs tev piedāvājam. Būtiski sīkfaili ir nepieciešami, lai mūsu pakalpojums darbotos pareizi. Ja esi priecīgs, ka mēs apkopojam informāciju, izmantojot mārketinga sīkdatnes, tad izvelies “Pieņemt visu”. Vienmēr vari mainīt minētos iestatījumus, apmeklējot sīkfailu iestatījumus.

Sīkfailu iestatījumi