Skip to content
nexubDesign System
v11.9.0

Components · Form Controls

Currency Select

AlphaAdded v11.2.0

A searchable ISO 4217 currency picker built from Intl: code, name and symbol. Also sits next to a MoneyInput.

import { CurrencySelect } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Picking the currency of a price, an invoice or an account.

  • Letting people change the currency next to an amount (`MoneyInput currencySlot`).

Use something else for
  • Two or three fixed currencies: use SegmentedControl or Select.

  • Showing an amount: use Amount.

Playground

Props

size
TSX
<CurrencySelect aria-label="Currency" value={currency} onValueChange={setCurrency} />

Examples

Default

Labelled field

`CurrencyField` adds `label`, `description` and `error`, as ComboboxField.

Invoices are issued in this currency

Next to an amount

MoneyInput `currencySlot` puts the picker before the amount.

States

  • default
  • disabled
  • invalid
  • readOnly
  • size="sm"
  • size="md"
  • size="lg"

Props

Props
PropTypeDefaultDescription
valuestring—The ISO 4217 code, e.g. "USD".
defaultValuestring—The ISO 4217 code, e.g. "USD".
onValueChange((value: string) => void)—Called with the picked code.
currenciesstring[]—Only these codes, in this order. Default: every code the browser knows (Intl.supportedValuesOf).
prioritystring[]—Codes listed first; with priorityLabel, under that heading and the rest under restLabel.
priorityLabelstring—Codes listed first; with priorityLabel, under that heading and the rest under restLabel.
restLabelstring—Codes listed first; with priorityLabel, under that heading and the rest under restLabel.
localestring—BCP 47 locale for names and symbols. Defaults to the user's.
namestring—A hidden input posts the code with a plain form.
size'sm' | 'md' | 'lg''md'Height of the field.
sheetfalse | true | 'auto''auto' (a bottom sheet below 768px)The list as a bottom sheet below 768px.
aria-describedbystring—
aria-invalidfalse | true | 'true' | 'false'—
aria-labelstring—
aria-labelledbystring—
aria-requiredfalse | true | 'true' | 'false'—
classNamestring—
disabledboolean—
emptyTextReact.ReactNode'No results found.'Shown when the search finds nothing.
idstring—
invalidboolean—
noneOptionstring—A first option that clears the value (null), labelled with this text, e.g. "No manager".
placeholderstring'Select…'Shown when nothing is picked.
readOnlyboolean—Shows the value; the list can't open. Stays focusable.
requiredboolean—
searchPlaceholderstring'Search…'The search box's placeholder.

Accessibility

Keyboard

  • Enter / Space / Arrow Down

    Opens the list with focus in the search box.

  • Type

    Finds by code, name or symbol.

  • Enter

    Picks the highlighted currency.

Notes

  • Built on ComboboxField: the trigger is a `combobox` named by the label.

  • `currencyOptions(locale)` returns the same list for your own ComboboxField.