SL

Currency Input

Forms

About

A formatted text input for entering monetary amounts, with prefix/suffix, thousands grouping, decimal control, and an optional clear button.

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 { useState } from "react";
import { Label } from "@/components/ui/label";
import { CurrencyInput } from "@/components/ui/currency-input";

export function CurrencyInputDemo() {
  const [monthlyPrice, setMonthlyPrice] = useState<string | undefined>("29.00");

  return (
    <div className="grid w-full max-w-md gap-6">
      <div className="space-y-1">
        <p className="font-medium text-sm">Billing settings</p>
        <p className="text-muted-foreground text-sm">
          Configure workspace pricing and account credits.
        </p>
      </div>

      <div className="space-y-2">
        <Label htmlFor="monthly-price">Monthly price</Label>
        <CurrencyInput
          decimalSeparator="."
          decimalsLimit={2}
          groupSeparator=","
          id="monthly-price"
          name="monthlyPrice"
          onValueChange={(value) => setMonthlyPrice(value)}
          placeholder="Enter monthly price"
          prefix="$"
          value={monthlyPrice}
        />
        <p className="text-muted-foreground text-sm">
          Charged once per workspace each month.
        </p>
      </div>
    </div>
  );
}

export default CurrencyInputDemo;

Dependencies

More by SL

View all
  • Playback Scrubber

    Playback Scrubber

    66
  • Matte Alert Feedback

    Matte Alert Feedback

    49
  • Notification Stack

    Notification Stack

    39
  • Time Window Slider

    Time Window Slider

    30
  • Matte Meter Slider

    Matte Meter Slider

    20
  • Commands Menu

    Commands Menu

    18
  • Matte Opacity Slider

    Matte Opacity Slider

    15
  • Undo Feedback

    Undo Feedback

    11

More in Forms

View all
  • Premium Auth

    Premium Auth

    593
  • Contact Form

    Contact Form

    28
  • Form

    Form

    4
  • Login 1

    Login 1

    70
  • Book A Demo 1

    Book A Demo 1

    94
  • Contact Card

    Contact Card

    1.1K
  • HeroUI Field Error

    HeroUI Field Error

    13
  • Form [react-aria-components]

    Form [react-aria-components]

    19