- Accordion
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- Checkbox
- Combobox
- Container
- CurrencyInput
- DistributionSlider
- Drawer
- Dropdown
- Grid
- Heading
- Image
- Input
- InputGroup
- Label
- Logo
- MapPin
- Modal
- NativeSelect
- NumberInput
- OtpInput
- PhoneInput
- Popover
- Progress
- PropertyCalendar
- RadioGroup
- RadioGroupCards
- ResponsiveModal
- ScrollArea
- SearchBar
- SearchBarFallback
- SearchInput
- Select
- Separator
- Spinner
- Switch
- Tabs
- Text
- Textarea
- Toast
- Toggle
- ToggleGroup
- Tooltip
CurrencyInput
A currency input component with locale-based formatting and real-time editing
pnpm add @wandercom/design-system-web
import { CurrencyInput } from '@wandercom/design-system-web';
export function Example() {
const [value, setValue] = useState<number | null>(1234.56);
return (
<CurrencyInput
value={value}
currency="$"
onChange={setValue}
/>
);
}Basic currency input with USD dollar symbol.
const [value, setValue] = useState<number | null>(1234.56);
<CurrencyInput
value={value}
currency="$"
onChange={setValue}
placeholder="0.00"
/>Currency input supports both default and small sizes.
const [defaultValue, setDefaultValue] = useState<number | null>(99.99);
const [smallValue, setSmallValue] = useState<number | null>(49.99);
<div className="flex flex-col gap-4">
<CurrencyInput
value={defaultValue}
currency="$"
onChange={setDefaultValue}
size="default"
/>
<CurrencyInput
value={smallValue}
currency="$"
onChange={setSmallValue}
size="sm"
/>
</div>Currency input with different locales and currencies. Each locale uses proper number formatting and currency symbol positioning.
import { Label } from '@wandercom/design-system-web';
const [usdValue, setUsdValue] = useState<number | null>(1234.56);
const [eurValue, setEurValue] = useState<number | null>(1234.56);
const [gbpValue, setGbpValue] = useState<number | null>(1234.56);
const [jpyValue, setJpyValue] = useState<number | null>(150000);
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-2">
<Label htmlFor="usd-input">United States (en-US)</Label>
<CurrencyInput
id="usd-input"
value={usdValue}
currency="USD"
locale="en-US"
onChange={setUsdValue}
/>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor="eur-input">Germany (de-DE)</Label>
<CurrencyInput
id="eur-input"
value={eurValue}
currency="EUR"
locale="de-DE"
onChange={setEurValue}
/>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor="gbp-input">United Kingdom (en-GB)</Label>
<CurrencyInput
id="gbp-input"
value={gbpValue}
currency="GBP"
locale="en-GB"
onChange={setGbpValue}
/>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor="jpy-input">Japan (ja-JP)</Label>
<CurrencyInput
id="jpy-input"
value={jpyValue}
currency="JPY"
locale="ja-JP"
onChange={setJpyValue}
/>
</div>
</div>Currency input with minimum and maximum value constraints.
const [value, setValue] = useState<number | null>(50);
<div className="flex flex-col gap-2">
<Label htmlFor="budget-input">Budget (min: $10, max: $100)</Label>
<CurrencyInput
id="budget-input"
value={value}
currency="$"
min={10}
max={100}
onChange={setValue}
placeholder="Enter amount"
/>
</div>Currency input in disabled state.
const [value, setValue] = useState<number | null>(500);
<CurrencyInput
value={value}
currency="$"
onChange={setValue}
disabled
/>value?:
currency?:
locale?:
onChange?:
onFocus?:
onBlur?:
placeholder?:
min?:
max?:
size?:
disabled?:
required?:
id?:
name?:
className?:
aria-label?:
aria-labelledby?:
aria-describedby?:
aria-invalid?:
Formatted Display - When not focused, displays the formatted currency value using Intl.NumberFormat with locale-specific formatting (e.g., "1,234.56").
Raw Editing - When focused, switches to raw numeric input for easy editing without formatting characters.
Automatic Parsing - On blur, parses the input value and converts it to a number, stripping non-numeric characters.
Value Clamping - If min or max props are provided, values are automatically clamped to the allowed range on blur.
Locale Support - Uses Intl.NumberFormat for locale-aware number formatting with proper thousands separators and decimal points.
Currency Symbols - Extracts currency symbols from currency codes (e.g., "USD" → "$") using Intl.NumberFormat, or uses custom symbols directly.
Keyboard Support - Press Enter to confirm and blur the input. Press Escape to cancel editing and restore the previous value.
Null Handling - When value is null or undefined, displays the placeholder text.
This component is built using InputGroup components and follows standard input accessibility patterns:
Keyboard Navigation:
Tab- Move focus to/from the inputEnter- Confirm value and blur inputEscape- Cancel editing and restore previous value
Screen Reader Support:
- Supports
aria-label,aria-labelledby, andaria-describedbyfor proper labeling - Supports
aria-invalidfor validation states - Currency symbol is visible but input receives focus for editing
Form Integration:
- Supports
nameprop for native form submission - Supports
requiredanddisabledstates - Compatible with form validation libraries
- Input Group - Composable input group components
- Number Input - Number input with increment/decrement buttons
- Input - Basic text input component