Ballmac UI home

Currency Input

A locale-aware money field that formats on blur while keeping editing and caret behavior simple.

Project budget

Formatted for your locale; edit as a number.

Installation

$ pnpm dlx shadcn@latest add @ballmac/currency-input

Usage

import { CurrencyInput } from "@/components/ballmac/currency-input"

The full example is in the Code tab above.

Examples

States and variants

API reference

PropTypeDefault
label*

Visible and accessible input label.

string—
currency

ISO 4217 currency code.

string"USD"
locale

Fixed locale for formatting and parsing.

string—
value

Controlled numeric amount, or null when empty.

number | null—
defaultValue

Initial numeric amount.

number | nullnull
onValueChange

Called with the parsed numeric amount while editing.

(value: number | null) => void—
min

Smallest allowed amount.

number—
max

Largest allowed amount.

number—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Tab / typingEnters a numeric amount and formats it on blur

Use with AI

A locale-aware money field that formats on blur while keeping editing and caret behavior simple. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Currency Input (@ballmac/currency-input) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Collect prices, budgets, or payment amounts

Not for

  • Use Number Input for unitless quantities

Registry JSON: https://ui.ballmac.com/r/currency-input.json

Credits

Free to use in personal and commercial projects.

npm
None