SavingsGoal
A goal ring that fills as you add to it. The saved amount rolls, and reaching the target turns the ring green. Finance.
Open playground61%
$920
$580 to go of $1,500
About
SavingsGoal is a React component in the Finance category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { SavingsGoal } from "@ashutoshswamy/smoui" and set name, saved, onChange among its 5 props.
Install
npm i @ashutoshswamy/smouiUsage
import { SavingsGoal } from "@ashutoshswamy/smoui";
<SavingsGoal name="Lisbon trip" target={1500} defaultSaved={920} steps={[10, 50, 100]} />Props 5
- name / target
The goal.
string / number- saved / defaultSaved
Controlled or starting amount.
number- onChange
Fires on every add or reset.
(saved: number) => void- steps
Quick-add amounts. Default 10, 50, 100.
number[]- currency
ISO code. Default USD.
string
More finance components
- AmountInputA big amount field. Digits group as you type, the figure shakes and turns red past your balance, and chips add to it or fill the max.
- BalanceChartBalance over time. Switch the range and the line morphs; drag across it and the figure follows with the change since the start.
- CandlestickChartCandles that grow from their middle when scrolled into view. Point at one: the rest dim and a readout gives open, high, low and close.
- CardFormA payment card that fills in as you type. Digits group themselves, the brand is read from the first numbers, the number is checked with Luhn, and the card turns over when you reach the CVC.
- CreditCardA card that tilts toward the pointer and flips to its back. The number is masked down to the last four digits.
- CurrencySwapA two-way converter. Type an amount and the result eases to its value; the swap button turns the pair around.