DocsComponentsTemplatesThemesGitHub

CurrencyInput

Money amount with the currency symbol, locale grouping (12,00,000 in en-IN), and an attached currency code.

Code

import * as React from 'react';
import { CurrencyInput } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        display: 'flex',
        gap: 16,
        maxWidth: 560,
      }}
    >
      <CurrencyInput label="Annual CTC" currency="INR" locale="en-IN" defaultValue={1200000} />
      <CurrencyInput label="Price" currency="USD" locale="en-US" decimals={2} defaultValue={49} />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { CurrencyInput } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/currency-input.json

Guidelines

  • Value is a number (or null). Shows raw digits while editing, formatted on blur.
  • Use for salary/CTC, prices and budgets; set currency and locale.

Props

PropTypeRequired
valuenumber | nullNo
defaultValuenumber | nullNo
onChange(value: number | string | null) => voidNo
currencystringNo
localestringNo
decimalsnumberNo
showCodebooleanNo
labelstringNo
hintReact.ReactNodeNo
errorReact.ReactNodeNo
requiredbooleanNo
placeholderstringNo
size'sm' | 'md' | 'lg'No
classNamestringNo
styleReact.CSSPropertiesNo

Edit this example on GitHub