---
title: "Currency Input"
description: "A field for an amount of money in one currency. It puts the symbol where the locale puts it, groups thousands, and keeps the cents of the currency."
url: https://gelatinui.com/components/currency-input
markdown_url: https://gelatinui.com/components/currency-input.md
access: free
install: "npx shadcn@latest add @gelatin-ui/currency-input"
registry_item: https://gelatinui.com/r/currency-input.json
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Currency Input

> A field for an amount of money in one currency. It puts the symbol where the locale puts it, groups thousands, and keeps the cents of the currency.

Page: https://gelatinui.com/components/currency-input

## When to use it

Best for: An amount of money in one currency, formatted for the locale as people type.

- Use it for an amount, a price, or a budget.
- Use `min` and `max` for the range. The mask stops an amount over `max`.
- Use `locale` for the separators and the symbol side of another country.

## When not to use it

- For a number with no currency, use a [Masked Input](https://gelatinui.com/components/masked-input.md).
- For a number with steppers, use a [Number Field](https://gelatinui.com/components/number-field.md).

## Notes for agents

- `onValueChange(text, details)`: `details.unmasked` is the number. Add numbers, never the shown text.
- Send money to a server as a decimal string, not as a sum of floats.
- A paste with both marks ("1.234,56" or "1,234.56") reads the last mark as the decimal.
- The parts are `CurrencyInputSymbol`, `CurrencyInputControl`, and `CurrencyInputCode`. With no children it renders the symbol and the control.

## Anatomy

```text
CurrencyInput
├─ CurrencyInputSymbol (0..n)
├─ CurrencyInputCode (0..n)
└─ CurrencyInputControl (0..n)
```

## API reference

### CurrencyInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `rounded` | `"default" \| "full"` | "default" |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` | "default" |  |
| `variant` | `"dashed" \| "default"` |  |  |
| `disabled` | `boolean` | false | Turns the control off; the frame fades to 50% with it (the Base UI name). |
| `readOnly` | `boolean` | false | The amount shows and can be copied, but not changed (the Base UI name). |
| `currency` | `string` |  | The ISO 4217 code: "USD", "EUR", "JPY". It sets the symbol and the fraction digits. |
| `locale` | `string` |  | The locale of the separators and the symbol side. Default: the display locale (en-US unless a provider sets one). |
| `min` | `number` |  | The smallest amount; `valid` is false below it (a lower amount can still be typed). |
| `max` | `number` |  | The largest amount. The mask stops a larger one as you type, so it never shows. |
| `value` | `string` |  | The shown amount (controlled). "1250" shows "1,250". |
| `defaultValue` | `string` | "" | The first shown amount (uncontrolled). |
| `onValueChange` | `function` |  | Runs on every change with the text, the number (`details.unmasked`), and the checks. |

### CurrencyInputSymbol

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### CurrencyInputCode

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### CurrencyInputControl

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `guide` | `boolean` |  | The ghost guide of the slots still to fill, while the input has focus. Default `true`. |
| `rawName` | `string` |  | Also submit the raw value under this name (a hidden input), next to the shown one. |
| `rejectFeedback` | `boolean` |  | Nudge the field 2px when the mask rejects a key. Default `true`. |
| `onReject` | `function` |  | Runs when the mask rejects a key (a letter in a number, a 13th month). |
| `ref` | `Ref<HTMLInputElement>` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` |  |  |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| CurrencyInput | `currency-input` |  |  |  |
| CurrencyInputSymbol | `currency-input-symbol` |  |  |  |
| CurrencyInputCode | `currency-input-code` |  |  |  |
| CurrencyInputControl | `currency-input-control` |  |  |  |

## Usage

Put the symbol, the control, and the code in the input, inside a Field with a label and a description.

The sample also uses `field`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/currency-input @gelatin-ui/field
```

```tsx title="monthly-budget.tsx"
import {
  CurrencyInput,
  CurrencyInputCode,
  CurrencyInputControl,
  CurrencyInputSymbol,
} from "@/components/ui/currency-input";
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";

export function MonthlyBudget() {
  return (
    <Field name="budget">
      <FieldLabel>Monthly budget</FieldLabel>
      <CurrencyInput currency="USD" min={5} max={500} defaultValue="50">
        <CurrencyInputSymbol />
        <CurrencyInputControl />
        <CurrencyInputCode />
      </CurrencyInput>
      <FieldDescription>Paid on the 1st of each month</FieldDescription>
    </Field>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/currency-input
```

It adds 28 registry items: 25 files, 5470 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@maskito/core`, `@maskito/kit`, `@maskito/react`, `@phosphor-icons/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Input Group](https://gelatinui.com/components/input-group.md)
- [Masked Input](https://gelatinui.com/components/masked-input.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Masked Input](https://gelatinui.com/components/masked-input.md)
- [Input Group](https://gelatinui.com/components/input-group.md)
- [Number Field](https://gelatinui.com/components/number-field.md)
- [Field](https://gelatinui.com/components/field.md)

## Accessibility

It is a native input with a decimal keypad, in a `Field` for the label and the error.

The symbol is visible text next to the input, so it is read with the field.

## Motion

| Part | Motion |
| --- | --- |
| Rejected key | indicator · the frame moves 2px to each side and back when the mask rejects a key |
