CurrencySelector

Compact currency picker with optional country flag and background treatment.

Quick Preview

With background

Open menu

Usage

import { CurrencySelector } from "@giddaa-housing/ui/currency-selector";

const currencies = [
	{ code: "NGN", label: "Naira" },
	{ code: "USD", label: "Dollar" },
];

<CurrencySelector options={currencies} defaultValue="NGN" />;

Examples

Flags

Flags are inline SVGs resolved from the currency code — ISO 4217 codes lead with their country, so NGN renders the NG flag and EUR renders the EU flag. NG, US, GB, EU, CA, JP, GH, and AE ship with the package; anything else falls back to a neutral globe until you pass your own artwork.

// Override the derived country, or supply artwork outright.
{ code: "XOF", label: "West African CFA Franc", countryCode: "SN" }
{ code: "BTC", label: "Bitcoin", flag: <BitcoinMark className="size-4" /> }

Visual Variants

Use withBackground and showFlag to match compact toolbar or pill-style placements.

Without background, with flag

With background, without flag

Without background or flag

Props

Prop/APITypeDefaultDescription
optionsCurrencySelectorOption[]-Currency options with code, label, and optional countryCode/flag.
option.countryCodestringfirst two letters of codeISO 3166-1 alpha-2 code that selects the built-in flag.
option.flagReactNode-Custom flag artwork for currencies the built-in set does not cover.
value / defaultValuestringfirst optionControlled or uncontrolled selected currency code.
onValueChange(value, option) => void-Called when a currency is selected.
open / defaultOpenboolean-Controlled or uncontrolled dropdown open state.
withBackgroundbooleantrueUses tertiary action surface for the trigger.
showFlagbooleantrueShows the selected option flag in the trigger.
showOptionFlagsbooleantrueShows flags inside dropdown options.
size`"sm""md""lg"`
className / contentClassNamestring-Local trigger or dropdown styling overrides.

Accessibility

  • Provide clear label values because each option is announced as currency code plus currency name.
  • Use value/defaultValue codes that match one of the provided options.
  • Preserve the component-provided Select behavior for keyboard navigation, focus, and selection.
  • Do not communicate selection by color alone; the dropdown includes a check icon for the active option.

On this page