Blocks / Amount and status badge

Amount and status badge

A signed amount, sign in text and tone in colour; the state of a document in a word.

import { AmountBadge, StatusBadge } from "@forgeron/ui";
/01 → Default
€1,250.00credit€42.50debit€42.50debit€0.00
DraftSentPaidOverdue
import { AmountBadge, StatusBadge } from "@forgeron/ui";

export default function Default() {
  return (
    <div style={{ display: "grid", gap: 8 }}>
      <AmountBadge amount={125000} currency="EUR" locale="en" />
      <AmountBadge amount={-4250} currency="EUR" locale="en" />
      <AmountBadge amount={-4250} currency="EUR" locale="en" invert />
      <AmountBadge amount={0} currency="EUR" locale="en" />
      <div style={{ display: "flex", gap: 8 }}>
        <StatusBadge status="draft" />
        <StatusBadge status="sent" />
        <StatusBadge status="paid" />
        <StatusBadge status="overdue" />
      </div>
    </div>
  );
}
API → Props
PropTypeDefaultDescription
amountnumber—Minor units, signed.
currencystring—An ISO 4217 code (`EUR`, `USD`, `JPY`): every amount is in its minor units.
localestring—A BCP 47 tag for the numbers and the symbol; the device's by default.
tone"auto" | "positive" | "negative" | "neutral""auto"Auto: money in is positive, out negative.
invertbooleanfalseSwaps the auto colours.
showPlusbooleantrueWrites + before a positive amount.
StatusBadge status / tone / labelstring—draft, sent, paid, overdue… map to a tone; any word with its tone.
classNamestring—Extra classes.