CurrencyPicker provides a compact selected currency code and searchable currency options. Import it from twenty-ui/components and compose it inside a Dropdown with type="picker".
Usage
Supply the available currencies and the selected code.Options calls onValueChange with the chosen code. The trigger requires a currency code through value; your application chooses its initial value and any fallback.
Trigger and Options can be used separately. Use Options with a Dropdown.Trigger rendering a Twenty UI Button when the host needs a full button instead of the compact code control.
Search and selection
Search ignores surrounding whitespace and matches currency codes, names, and the displayedName (CODE) label without case sensitivity, using the same matching rules in every browser locale. Results keep the supplied order, with the selected currency first when it matches the search. Each row shows Name (CODE) and exposes its selected state through aria-pressed.
Search receives focus when the picker opens. With a nonempty search, Enter selects the first enabled match. With an empty search, Enter does nothing until ArrowDown moves focus to an option. Empty results keep the picker open and show the empty label in a status region that stays in place while the picker is open, so screen readers announce it. Selection closes a single-selection dropdown; Escape and outside interaction use the dropdown’s existing dismissal and focus behavior.
Set disabled on a currency to keep its row visible while preventing selection. Trigger.disabled prevents opening; Options.disabled disables search and all options in an already open host.
Ownership and labels
The picker owns searching, selected-first ordering, and currency selection. The application owns the currency catalogue, amount editing, formatting, default currency, persistence, and dropdown lifecycle. Currency names are data supplied by the caller.searchLabel defaults to Search and provides both the search placeholder and accessible name. emptyLabel defaults to No results. Supply translated labels and accessible names from your application. Give the trigger an accessible name that includes its visible currency code, such as Invoice currency: USD, and give the dropdown content a name that describes the currency being selected.
Native attributes, className, style, ref, and render apply to each part’s root element. The trigger forwards the shared dropdown trigger interface, except children, hover opening (openOnHover, delay, closeDelay), and the popover handle and payload props; the options root is a div by default.
Front-component renderer
React and Preact sandbox fixtures verify code presentation and the disabled trigger. Opening the popup currently fails in the shared Dropdown foundation because the worker cannot read viewport width. Search, currency selection, popup focus, and closing are not supported in that sandbox until this limitation is resolved. Ordinary React hosts exercise the complete interaction.Props
CurrencyPicker.Trigger
string | ((state: PopoverTriggerState) => string | undefined)
CSS class applied to the element, or a function that
returns a class based on the component’s state.
boolean
Disables opening the picker.
string
ID forwarded to the trigger button.
boolean
default:"true"
Whether the component renders a native
<button> element when replacing it
via the render prop.
Set to false if the rendered element is not a button (e.g. <div>).ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, PopoverTriggerState>
Replaces the native trigger button. Forward the supplied props and ref when rendering a custom component.
CSSProperties | ((state: PopoverTriggerState) => CSSProperties | undefined)
Style applied to the element, or a function that
returns a style object based on the component’s state.
string
required
Required currency code displayed beside the chevron. The application chooses its initial value and any fallback.
CurrencyPicker.Options
readonly CurrencyPickerOption[]
required
Available currency codes and names, in catalogue order. Each code must be unique. An option can be disabled.
boolean
default:"false"
Disables search and every currency option.
string
default:"No results"
Text announced when no currencies match. Defaults to No results.
(code: string) => void
required
Called with the code chosen by pointer or keyboard. The application updates the selected value.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>
Replaces the non-interactive root div. Forward the supplied props and ref when rendering a custom component.
string
default:"Search"
Search placeholder and accessible name. Defaults to Search.
string
Selected currency code. Its matching row appears first and is marked pressed.