Skip to content

A simple and customizable React component for formatting currency values

Notifications You must be signed in to change notification settings

victorolayemi/react-currency-formatter-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Currency Formatter React

A simple, lightweight, and customizable React component for displaying localized currency values using the browser's Intl.NumberFormat API.

npm version license downloads


✨ Features

  • 🌐 Supports any locale and currency via Intl.NumberFormat
  • βš™οΈ Optional control over decimal precision
  • πŸ’‘ Null-safe rendering
  • βš›οΈ Tiny, tree-shakable React component

πŸ“¦ Installation

npm install react-currency-formatter-lite
yarn add react-currency-formatter-lite

πŸš€ Usage


import React from 'react';
import { CurrencyFormatter } from 'react-currency-formatter-lite';

const App = () => {
  return (
    <div>
      <CurrencyFormatter value={1234.56} />
      <CurrencyFormatter value={1234.56} currency="EUR" locale="de-DE" />
      <CurrencyFormatter value={1234.56} currency="JPY" decimalPrecision={0} />
    </div>
  );
};

βš™οΈ Props

Prop Type Default Description
value number | null required The numeric value to format
decimalPrecision number 2 Number of decimal places
locale string "en-US" BCP 47 locale string for localization
currency string "USD" ISO 4217 currency code (e.g. USD, EUR, JPY)

βœ… Example Output

<CurrencyFormatter value={1234.56} currency="EUR" locale="de-DE" />
// €1.234,56

πŸ“ License

MIT License Β© Victor Olayemi

About

A simple and customizable React component for formatting currency values

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published