金額入力CurrencyInputExperimental
Money editor: a currency-symbol-prefixed, thousands-grouped, right-aligned amount input that formats while typing and emits a numeric value. JPY-first; for invoices, payroll, expenses, and any fintech amount field.
プレビュー
Props
表は横にスクロールできます
| プロパティ | 型 | 初期値 | 説明 |
|---|---|---|---|
| label | ReactNode | - | Visible label rendered above the control and associated via htmlFor (like Input / Select / Textarea). |
| description | ReactNode | - | Helper text under the control, wired via aria-describedby. |
| value | number | - | Numeric amount (controlled). |
| onValueChange | (value: number | undefined) => void | - | Fires with the number, or undefined when cleared. |
| currency | string | "JPY" | ISO 4217 code for the symbol + grouping. |
| locale | string | "ja-JP" | BCP-47 locale for the symbol + grouping. |
| showSymbol | boolean | true | Show the currency symbol as a leading adornment. |
| min / max | number | - | Clamp the entered value. |
| ...InputHTMLAttributes | — | - | id, name, placeholder, disabled, aria-*, className, etc. |
Usage
import { CurrencyInput, formatCurrency } from "@gunjo/ui"
export function Example() {
const [amount, setAmount] = React.useState<number | undefined>(1200000)
return (
<CurrencyInput value={amount} onValueChange={setAmount} min={0} />
// value is a number; display elsewhere with formatCurrency(amount)
)
}