LoanCalculator
Monthly payment from amount, term and rate. Drag a slider and the payment rolls while the bar re-splits into principal and interest. Finance.
Open playgroundMonthly payment$1,535.22
Loan amount$250,000
250000
Term25 years
25
Interest rate5.5%
5.5
Principal$250,000Total interest$210,566
About
LoanCalculator 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 { LoanCalculator } from "@ashutoshswamy/smoui" and set defaultAmount, defaultYears, defaultRate among its 4 props.
Install
npm i @ashutoshswamy/smouiUsage
import { LoanCalculator } from "@ashutoshswamy/smoui";
<LoanCalculator defaultAmount={250000} defaultYears={25} defaultRate={5.5} />Props 4
- defaultAmount / maxAmount
Loan size.
numberdefault250000 / 1000000- defaultYears
Term in years.
numberdefault25- defaultRate
Annual rate in percent.
numberdefault5.5- currency
ISO currency code.
stringdefault"USD"
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.