Skip to content

Components / Sections

Mortgage Calculator

What a home costs a month. To buy: the price, the deposit on a slider, the rate and the term, and the monthly payment, the loan and the interest over the term. To rent: the deposit in months and the household's income, and the money to move in, the year's rent and the rent's share of the income. The first figures are worked out at build from the defaults and a few lines of script work out the rest as the fields change; without JavaScript the fields are not shown and a table worked out at build takes their place. An estimate, and it says so under itself.

Live demo

What it would cost a month

Each month
$3,796
Loan
$676,000
Interest over the term
$462,770
Monthly payment by deposit and term
Deposit15 years20 years25 years30 years
10%$5,857$4,852$4,270$3,899
20%$5,206$4,313$3,796$3,465
30%$4,555$3,774$3,321$3,032

An estimate to plan with. A lender works out the real figure.

Live, from the library itself, at full size: scroll, hover, navigate away and back. The demo is never gated.

Variants · each row writes the attribute the prop writes; the section's own CSS answers

tone
density
mode

Measured

JavaScript of its own

845 B raw

526 B gzip.

Uses Reveal and the shared runtime (1.9 kB raw, once per site). With those included: 3.8 kB raw.

CSS 10.4 kB raw including the base tokens. Measured from a production build, and again in CI for every change that can move it.

Browser support

Baseline · widely available

every browser. Elsewhere: without JavaScript a table of payments worked out at build.

Install Pro

The demo above is never gated; the source is. With a key in components.json (see account), the registry serves it like any other item:

terminal
npx shadcn@latest add @moonarc-pro/mortgage-calc
src/pages/index.astro
---
import MortgageCalc from '@/components/moonarc/pro/MortgageCalc.astro';
---
<MortgageCalc
  headline="What it costs a month"
  amount={845000}
  deposit={20}
  rate={4.5}
  term={25}
/>

Without a key the registry answers 401 with an upgrade message. Everything this section composes is free: reveal.

Props

PropTypeDefaultDescription
amountnumbernoneThe price (buy) or the monthly rent (rent), in whole units.
mode'buy' | 'rent''buy'A loan's monthly payment, or the money to move in and the rent's share of the income.
formatstring'{currency}{n}'How a sum prints: {currency} is the currency, {n} the number.
currencystring'$'The currency's sign or code.
localestring'en-US'How the numbers are grouped.
depositnumber20Buy: the deposit's share the slider starts at, in %.
ratenumber4.5Buy: the yearly rate the field starts at, in %.
termnumber25Buy: the term in years the field starts at.
termsnumber[][15, 20, 25, 30]Buy: the terms offered.
monthsnumber[][1, 2, 3]Rent: the deposits offered, in months.
incomenumber6000Rent: the household income a month the field starts at.
wordsPartial<Record<…, string>>EnglishEvery word of the fields, the results, the table and the note.
headlinestringnoneThe heading.
eyebrowstringnoneA short line above the heading.
copystringnoneA line under the heading.
level2 | 32Heading level of the heading.
tone'surface' | 'muted' | 'ink' | 'brand'unset (paints nothing)The section's ground.
density'compact' | 'cozy' | 'roomy''cozy'Block padding ×0.8 / ×1 / ×1.25 through --ma-density.

Theming and overrides

The section reads the theme contract (shadcn's variable names with the base tokens as fallback), so a pasted theme or one --ma-brand recolours it. Its class names are the override surface and stay stable; a named slot replaces the matching prop with your own markup.

Classes

.ma-mort.ma-mort__big.ma-mort__body.ma-mort__copy.ma-mort__eyebrow.ma-mort__field.ma-mort__form.ma-mort__head.ma-mort__headline.ma-mort__inner.ma-mort__note.ma-mort__result.ma-mort__table

Slots

slot="headline"

Reduced motion

Nothing moves; the figures change in place.

With ClientRouter

Bound per element through the runtime.

Why it is built this way

Replaces: Embedded mortgage calculator widgets from lenders. See the migration table.

Room by room

Point at a room in the list to find it on the plan.

Rooms · Ground floor

  • Living room22.5 m²
  • Kitchen18 m²
  • Hall7.5 m²
  • Dining room19.5 m²

Total67.5 m²

Rooms · First floor

  • Bedroom 118 m²
  • Bedroom 218 m²
  • Bathroom10.5 m²
  • Bedroom 312.3 m²
  • Landing8.8 m²

Total67.5 m²

A home's floors drawn from its rooms: each room a rectangle on a grid of metres with its walls round it and its name and area over it, and beside the plan the same rooms as a list with the total.

newly · Chrome 105 · Firefox 121 · Safari 15.4pointerclick

The Boathouse

Southbank, on the river path

$1,150,000 Guide price (a sample)

Bedrooms
4
Bathrooms
3
Floor area
204 m²
Built
2019

Book a viewing

The top of a home's own page: its pictures on one side, each a building drawn by HomeArt under a Lens that magnifies it at the pointer, with a row of thumbnails that picks one (radios and :has(), so the arrow keys move along them); on the other side the price, the title, the address, the facts and two actions.

newly · Chrome 105 · Firefox 121 · Safari 15.4clickpointer

Free

$0/yr

MIT, forever

  • 125 primitives, no account, no token
  • Runtime, GSAP and Lenis adapters
  • Public shadcn registry
  • MCP server
Set up in five minutes

Pro

$129/yr

One person, billed yearly

  • 108 sections and 11 GPU effects, demos never gated
  • Every template: Waitlist, Launch, Agentic, Studio, Agency, Atelier, Gather, Creator, Endpoint, Homescreen, Estate, Practice, and Stay
  • audit_motion and measure_budget, locally and in CI
  • compose_section with a total cost
  • New components monthly, dated changelog
  • Email support within 2 working days
Not open yet: see the plan

Team

$349/yr

Up to 10 people, one invoice

  • Everything in Pro, for the whole team
  • One key for the team, locally and in CI
  • Move up from Pro at any time
  • More than 10 people: email us
Talk to us

Shows pricing plans side by side, with an annual/monthly toggle that rolls every price digit by digit to the other period with zero JavaScript (radios, :has and NumberFlow), the highlighted plan wearing a travelling border beam, cards revealed with a stagger.

newly · Chrome 125 · Firefox 128 · Safari 16.4scrollclick

Also: view transitions · how costs are measured · browser support · accessibility policy · five-minute setup · MCP for agents · this page as Markdown