Naira input

Naira input is a neobrutalist React component from Cruise UI. A ₦ amount field that formats 12,500 as you type and gives back a plain number. Install it with npx shadcn@latest add @cruiseui/naira-input.

Install

Terminal

npx shadcn@latest add @cruiseui/naira-input

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

Between ₦1,000 and ₦500,000.

Value: 12500

When to use it

When to use

Any amount of money in naira: prices, transfers, budgets.

When not to

Other currencies. Ranges (use a Slider).

Props

CruiseNairaInput

PropTypeDefaultDescription
label?string—Visible label. Leave out inside a CruiseFormField (it brings the label).
hint?string——
error?string—Your own error; min/max messages are added for you.
value?number | null——
defaultValue?number | null——
onValueChange?((value: number | null) => void)—The plain number (12500), or null when empty.
onValidate?((message: string | undefined) => void)—Called with the min/max message (or undefined) after the field is left.
kobo?booleanfalseAllow kobo: up to two decimal places.
min?number——
max?number——

Also takes every native <input> attribute.

Accessibility

  • inputMode="decimal" opens the number pad on phones.
  • The caret stays in place while commas are added.
  • Min / max messages show after leaving the field, through the FormField error.