SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

UsageEstimate

A usage-pricing calculator that needs no script.

Free hours5 h × $0.00$0.00
Recorded hours35 h × $0.36$12.60
Per month$12.60

Everyone in the workspace reads the notes free.

View code
tsx
<UsageEstimate
	action="#pricing"
	fields={
		<TextField label="Recorded hours a month" type="number" name="hours" defaultValue="40" />
	}
	submitLabel="Estimate"
	bill={
		<UsageEstimate.Bill
			label="Estimated monthly bill"
			rows={[
				{ label: "Free hours", detail: "5 h × $0.00", amount: "$0.00" },
				{ label: "Recorded hours", detail: "35 h × $0.36", amount: "$12.60" },
			]}
			total={{ label: "Per month", amount: "$12.60" }}
			footnote="Everyone in the workspace reads the notes free."
		/>
	}
/>

// Live: the bill is a frame the page's route answers for X-Remix-Target "pricing-bill"
// <UsageEstimate action="#pricing" fields={…} submitLabel="Estimate" live={{ frame: "pricing-bill", src: "/?hours=40" }} />

Demo landings

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { UsageEstimate } from "@sdxc/ui/landing";

A GET form beside its bill on one card, side by side from 40rem, the sheet ruled in --ui-landing-hairline; with no script a submit reloads the page on the new bill. For live, map UsageEstimateLive (@sdxc/ui/landing/usage-estimate) to re-price while typing.

Composition

The parts the component publishes, each a static property of the host.

  • UsageEstimate
  • UsageEstimate.BillThe bill a calculator shows: its lines and total in a column of tabular figures, then the footnote and the CTA at the sheet's foot.

Examples

tsx
<UsageEstimate
	action="#pricing"
	fields={<TextField label="Hours a month" type="number" name="hours" defaultValue="40" />}
	submitLabel="Estimate"
	live={{ frame: "pricing-bill", src: "/?hours=40" }}
/>

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

UsageEstimate.Bill

PropTypeRequiredDescription
labelstringYesAccessible name of the bill's table, such as "Estimated monthly bill".
rowsreadonly Row[]YesThe bill's lines, in the order they add up.
totalRowYesThe sum, set larger under a rule.
footnoteRemixNodeNoA line under the total, such as what the price leaves out.
ctaRemixNodeNoThe page's next step under the bill, such as its primary CTA.
@sdxc/ui

Can’t find it? Contact us