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 playground
61%

Lisbon trip

$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

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
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