Mohammad Shehadeh

Currency Input

Forms 1

About

Locale-aware grouping with currency-symbol prefix and configurable decimal precision.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Currency Input to your project and fits it to your theme.

Code

How Currency Input is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";

import { Field, FieldGroup, FieldLabel } from "@/components/ui/field";
import {
  CurrencyInput,
  CurrencyInputField,
  CurrencyInputPrefix,
} from "@/components/ui/currency-input";

export default function CurrencyInputDemo() {
  const [basic, setBasic] = React.useState<number | null>(1499.5);
  const [composed, setComposed] = React.useState<number | null>(12480);

  return (
    <FieldGroup className="max-w-md gap-8">
      <Field className="gap-2">
        <FieldLabel htmlFor="cur-basic">USD</FieldLabel>
        <CurrencyInput
          id="cur-basic"
          value={basic}
          onValueChange={setBasic}
          currency="USD"
          locale="en-US"
          decimals={2}
        >
          <CurrencyInputPrefix />
          <CurrencyInputField />
        </CurrencyInput>
        <p className="font-mono text-[11px] text-muted-foreground">
          parsed: {basic === null ? "null" : basic}
        </p>
      </Field>

      <Field className="gap-2">
        <FieldLabel htmlFor="cur-composed">EUR (de-DE)</FieldLabel>
        <CurrencyInput
          id="cur-composed"
          value={composed}
          onValueChange={setComposed}
          currency="EUR"
          locale="de-DE"
          decimals={2}
        >
          <CurrencyInputPrefix />
          <CurrencyInputField placeholder="0,00" />
        </CurrencyInput>
        <p className="font-mono text-[11px] text-muted-foreground">
          parsed: {composed === null ? "null" : composed}
        </p>
      </Field>
    </FieldGroup>
  );
}

More by Mohammad Shehadeh

View all
  • Feature Problem Cards

    Feature Problem Cards

    90
  • Feature Grid Spotlight Cards

    Feature Grid Spotlight Cards

    73
  • Ecommerce Category Page

    Ecommerce Category Page

    72
  • Split Login

    Split Login

    68
  • Comparison Section

    Comparison Section

    65
  • Dithered Shader CTA

    Dithered Shader CTA

    64
  • Comparison Table

    Comparison Table

    64
  • FAQ Two Column

    FAQ Two Column

    63

More in Forms

View all
  • Premium Auth

    Premium Auth

    524
  • Contact Card

    Contact Card

    1K
  • Book A Demo 1

    Book A Demo 1

    73
  • Login 1

    Login 1

    53
  • Form

    Form

    137
  • Card Studio

    Card Studio

    41
  • SignInPage

    SignInPage

    668
  • Modern & Stunning sign in

    Modern & Stunning sign in

    1.6K

Explore more

Part of Hirael — browse the full library on 21st.dev.