Atelier UI

搜索组件…

搜索组件…

Currency Input

输入时自动加千分位、失焦补两位小数的金额输入框,可切换币种。

在沙盒中编辑

复制一段给 AI 编程工具的提示词,包含源码、依赖和用法

属性

CurrencyInputProps

同时支持以下类型的全部属性: Omit<React.ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "min" | "max" | "type" | "size">

属性类型默认值说明
valuenumber | null—Controlled numeric value (null = empty)
defaultValuenumber | nullnull—
onValueChange(value: number | null) => void——
currencyCurrencyCode—Controlled currency
defaultCurrencyCurrencyCode"USD"—
onCurrencyChange(currency: CurrencyCode) => void——
lockCurrencybooleanfalseHide the currency selector and lock the currency
minnumber——
maxnumber——
labelstring——
hintstring——
errorstring—External error message (takes precedence over min/max validation)

安装

$ npx shadcn@latest add https://chromotion.dev/r/currency-input.json

同类组件