UI

Usage pricing

Seat-plus-metered pricing estimator with seats and API traffic sliders, a billing toggle, an auto-recommended plan card with tier meter and morphing features, and a live cost breakdown.

import { UsagePricing } from '@uthereal/ui/usage-pricing'

Usage pricing playground

Estimate your bill

Save $881 a year

Breakdown

Growth seats18 × $24
$432
API requests15M used, 5M over at $4 per million
$20
Estimated totalPer month, before tax
$452
Loading interactive preview…

Overview

UsagePricing pairs two stepped sliders—Seats and API requests per month—with a monthly/yearly billing toggle to recommend the right plan tier in real time. Each slider marks the stops where the next tier takes over, and the savings indicator beside the toggle rolls continuously as sliders move, turning green with a drawn check once yearly billing is active.

On the plan card, a multi-segment tier meter fills to the recommended plan, the plan name and unlocked feature values morph in place, newly unlocked features rise to the top of the list while the card height springs smoothly, and the Breakdown section itemizes seat cost, included or overage API traffic, yearly discount, and estimated monthly total.

Use UsagePricing on pricing pages where cost combines seats with metered usage. For pure per-seat pricing across multiple side-by-side plan cards, use Pricing calculator. For a fixed tier matrix, use Plan comparison.

Usage

'use client'
import { UsagePricing } from '@uthereal/ui/usage-pricing'

export function ApiPricingEstimator() {
  return (
    <UsagePricing
      defaultSeats={18}
      defaultTrafficMillions={15}
      startAction="start_usage_trial"
      onEstimateChange={(estimate) => {
        console.log(estimate.planId, estimate.total)
      }}
      onSelectPlan={(planId) => {
        console.log('Selected tier:', planId)
      }}
      onAction={(action, planId) => {
        console.log(action, planId)
      }}
    />
  )
}

Omit plans, seatStops, and trafficStops to render the built-in Starter, Growth, and Scale sample estimator with local slider, toggle, and undoable trial-start state (nothing leaves the browser).

Examples

Enterprise Scale tier in euros

Seed the sliders at defaultSeats={100} and defaultTrafficMillions={75} with defaultInterval="yearly", currency={{ symbol: '€', code: 'EUR' }}, and locale="de-DE" to show all three meter bars filled, SAML SSO and Uptime SLA unlocked, metered overage above 50M included requests, and the yearly discount breakdown row.

Estimate your monthly API spend

High-throughput workloads automatically unlock Scale capacity and SLA coverage.

Save €7.296 a year

Breakdown

Scale seats100 × €38
€3.800
API requests75M used, 25M over at €2 per million
€50
Yearly billing100 × €6 off each seat
−€608
Estimated totalPer month, before tax
€3.242

Starter tier within included traffic

Seed at defaultSeats={3} and defaultTrafficMillions={0.5} on monthly billing to keep API traffic within the Starter plan's 1M included allowance, displaying "Included" in the breakdown row with zero overage charge.

Estimate your monthly API spend

Save $86 a year

Breakdown

Starter seats3 × $12
$36
API requests500k of 1M included
Included
Estimated totalPer month, before tax
$36

Recommendation and cost arithmetic

Tier selection rules

RuleFormula
Recommended tierLowest plan index whose seatLimit covers seats and trafficLimitMillions covers trafficMillions.
Seat costseats * plan.seatMonthly
Yearly seat discountMath.round(seats * plan.seatMonthly * (1 - plan.seatYearlyFactor)) when interval === 'yearly'.
Metered overageMath.round(Math.max(0, trafficMillions - plan.includedMillions) * plan.perMillion)
Estimated totalseatCost - discount + extra (per month, before tax).

You can also import estimateUsage directly from @uthereal/ui/usage-pricing to run the identical calculation on your server or checkout route.

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
titlestringDefault: "Estimate your bill"Heading and accessible section name.
descriptionstring—Supporting line below the heading. Pass an empty string (or null in React) to hide it.
defaultSeatsnumberDefault: 18Initial seat count; must be near a seat stop. Later argument edits do not reset a mounted instance.
defaultTrafficMillionsnumberDefault: 15Initial monthly requests in millions; must be near a traffic stop. Later argument edits do not reset a mounted instance.
defaultIntervalmonthly | yearlyDefault: "monthly"Initially chosen billing period. Later argument edits do not reset a mounted instance.
plansUsagePlan[]Default: [{"id":"starter","name":"Starter","seatMonthly":12,"seatYearlyFactor":0.8,"seatLimit":5,"includedMillions":1,"trafficLimitMillions":2,"perMillion":8,"features":[{"id":"logs","label":"Request logs","tier":0,"values":["7 days","30 days","13 months"]},{"id":"rate","label":"Rate limit","tier":0,"values":["100 req/s","1,000 req/s","10,000 req/s"]},{"id":"support","label":"Support","tier":0,"values":["Email","Priority","Named engineer"]}]},{"id":"growth","name":"Growth","seatMonthly":24,"seatYearlyFactor":0.83,"seatLimit":40,"includedMillions":10,"trafficLimitMillions":25,"perMillion":4,"features":[{"id":"domains","label":"Custom domains","tier":1,"values":["","Up to 10","Unlimited"]},{"id":"audit","label":"Audit log","tier":1,"values":["","90 days","2 years"]}]},{"id":"scale","name":"Scale","seatMonthly":38,"seatYearlyFactor":0.84,"includedMillions":50,"perMillion":2,"features":[{"id":"sso","label":"SAML SSO and SCIM","tier":2,"values":[]},{"id":"sla","label":"Uptime SLA","tier":2,"values":["","","99.99%"]}]}]Plan tiers in ascending order, each with seat rates, limits, included traffic, the per-million overage rate, and feature lines. The last plan has no upper limit.
seatStopsUsageSeatStop[]Default: [{"seats":1},{"seats":2},{"seats":3},{"seats":4},{"seats":5},{"seats":6},{"seats":8},{"seats":10},{"seats":12},{"seats":15},{"seats":18},{"seats":20},{"seats":25},{"seats":30},{"seats":35},{"seats":40},{"seats":45},{"seats":50},{"seats":60},{"seats":75},{"seats":100},{"seats":150},{"seats":200}]Seat slider stops, ascending and unique; denser at the low end where a single seat matters.
trafficStopsUsageTrafficStop[]Default: [{"millions":0.1},{"millions":0.25},{"millions":0.5},{"millions":0.75},{"millions":1},{"millions":1.25},{"millions":1.5},{"millions":2},{"millions":2.5},{"millions":3},{"millions":4},{"millions":5},{"millions":6},{"millions":7.5},{"millions":10},{"millions":12.5},{"millions":15},{"millions":20},{"millions":25},{"millions":30},{"millions":40},{"millions":50},{"millions":60},{"millions":75},{"millions":100},{"millions":150},{"millions":200}]Traffic slider stops in millions of requests per month, ascending and unique.
currencyobjectDefault: {"symbol":"$"}Currency of every price: the symbol before amounts and an optional ISO 4217 code for Intl formatting.
savingsLabelstringDefault: "Save {amount} a year"Yearly savings note template; {amount} fills the rolling savings amount.
breakdownTitlestringDefault: "Breakdown"Heading of the cost breakdown section.
seatsLabelstringDefault: "Seats"Label of the seats slider.
trafficLabelstringDefault: "API requests per month"Label of the traffic slider.
intervalLabelstringDefault: "Billing period"Accessible name of the monthly/yearly toggle.
monthlyLabelstringDefault: "Monthly"Label of the monthly billing option.
yearlyLabelstringDefault: "Yearly"Label of the yearly billing option.
includedLabelstringDefault: "Included"Traffic row value when the plan covers all requests.
seatsRowLabelstringDefault: "{plan} seats"Breakdown seat row label; {plan} fills the recommended plan name.
trafficRowLabelstringDefault: "API requests"Breakdown traffic row label.
yearlyRowLabelstringDefault: "Yearly billing"Breakdown discount row label when yearly billing is chosen.
totalRowLabelstringDefault: "Estimated total"Breakdown total row label.
perMonthLabelstringDefault: "per month"Unit after the estimated total price.
beforeTaxLabelstringDefault: "Per month, before tax"Note under the total row.
yearlyBilledLabelstringDefault: "{amount} a year for seats, usage monthly"Plan card billing note under yearly billing; {amount} fills the yearly seat total.
monthlyBilledLabelstringDefault: "Billed monthly, usage included"Plan card billing note under monthly billing.
startActionstring—Registered host action requested when the start button is pressed; reports the recommended plan id.
startLabelstringDefault: "Start with {plan}"Plan card action label; {plan} fills the recommended plan name.
startedLabelstringDefault: "Trial started"Plan card action label after the action is requested.
trialNoteLabelstringDefault: "14 days free, then billed as estimated"Note under the plan card action at rest.
undoLabelstringDefault: "Undo"Label of the inline action resetting the started state.
startNoteLabelstringDefault: "Trial started. {undo} to go back."Note under the plan card action once started; {undo} fills the undo action label.
recommendAboveLabelstringDefault: "Recommended above {seats} and {traffic}"Plan reason when both sliders passed the previous plan; {seats} and {traffic} fill its limits.
recommendSeatsLabelstringDefault: "Recommended above {seats}"Plan reason when only seats passed the previous plan; {seats} fills its seat limit.
recommendTrafficLabelstringDefault: "Recommended above {traffic}"Plan reason when only traffic passed the previous plan; {traffic} fills its request limit.
recommendBaseLabelstringDefault: "Covers up to {seats} and {traffic}"Reason on the first plan; {seats} and {traffic} fill its limits.
unlimitedLabelstringDefault: "Unlimited"Word used when a plan has no seat or traffic limit.
featuresLabelstringDefault: "Included in {plan}"Accessible name of the feature list; {plan} fills the recommended plan name.
priceFormatobject—Intl display format of every amount; defaults to plain decimal amounts with grouping.
localestring—BCP 47 locale for digit grouping and slider readouts; inherited when omitted.
recipestudio | softDefault: "studio"Visual treatment. Both recipes preserve interaction behavior.
themeUsagePricingThemeDefault: {}Color mode, accent, and typed semantic token overrides.
motionnone | subtle | expressiveDefault: "subtle"Animation preset. System reduced-motion preferences take precedence.
motionOptionsUsagePricingMotionOptionsDefault: {}Meter, feature reflow, height, and copy swap timing overrides in milliseconds.
dirltr | rtl—Reading direction; inherited from the page when omitted.
  • UsagePlan accepts { id, name, seatMonthly, seatYearlyFactor?, seatLimit?, includedMillions, trafficLimitMillions?, perMillion, features? }. List plans in ascending capacity order; omit limits on the top tier for unlimited coverage.
  • UsageFeature accepts { id, label, tier, values? }. Features appear when the recommended tier reaches feature.tier, with newly unlocked features sorted to the top and per-tier values morphing in place.
  • UsageSeatStop accepts { seats } and UsageTrafficStop accepts { millions }; both arrays must be ascending and unique.

React integration

PropPurpose
onEstimateChange(estimate)Called with the full UsageEstimate object after every slider or billing toggle change.
onSelectPlan(planId)Called with the recommended plan ID when the start button is activated.
onAction(action, itemId?)Called with startAction and the recommended plan ID when the start button is activated.
presetApplication defaults overridden by explicit instance arguments.
tokensCSS variables applied after the typed theme, forwarded to root, sliders, toggle, and CTA button.
ref, className, styleApplied to the root <section> element.
Native attributesid, aria-*, data-*, and remaining <section> props forwarded to the root element.

Keyboard & accessibility

KeyAction
TabMoves across the Seats slider, Traffic slider, billing toggle, CTA, and Undo.
ArrowLeft / ArrowRightSteps one stop on a slider, or switches Monthly / Yearly (RTL-aware).
PageUp / PageDownJumps three stops (largeStep={3}) along the Seats or Traffic slider.
Home / EndJumps to the minimum or maximum slider stop.
Enter / SpaceActivates the start button or the inline Undo control once started.
  • The root section, plan card <aside>, and breakdown <section> are each labelled by their heading via aria-labelledby, and the start CTA links its helper/undo text via aria-describedby.
  • Every OdometerNumber and MorphText readout pairs its decorative animated output with visually hidden full text so screen readers hear complete values (including savings sentences and morphed feature metrics).
  • The decorative tier meter carries aria-hidden="true", while a pre-mounted role="status" live region announces the recommended plan name and reason whenever sliders change the tier.
  • Container queries switch from a stacked layout to a two-column split (sliders and breakdown beside the sticky plan card) at 780px. Logical CSS properties and RTL meter origin mirror cleanly in dir="rtl", and @media (forced-colors: active) maps card borders, meter fills, discounts, and links to system colors.

Motion & theming

The tier meter bars stagger forward on upgrades and empty in reverse on downgrades, the plan name and upgraded feature metrics morph character by character, the feature list reflows with layout="position" while the card height springs via ResizeObserver, and every cost row rolls on an odometer.

Under prefers-reduced-motion: reduce, rolling digits jump, layout reflow and drawn checks turn off, and copy swaps use 120ms opacity crossfades. Setting motion="none" makes every transition immediate (0ms).

theme accepts mode, accent, and typed tokens across these groups:

Token groupCSS custom properties
core--ui-surface, --ui-surface-raised, --ui-text, --ui-text-secondary, --ui-muted, --ui-border, --ui-highlight, --ui-accent, --ui-accent-foreground, --ui-danger, --ui-focus-ring, --ui-radius, --ui-border-width, --ui-shadow, --ui-disabled-opacity, --ui-font, --ui-font-size, --ui-font-weight
extended--ui-surface-sunken, --ui-border-strong, --ui-border-subtle, --ui-track, --ui-info, --ui-success, --ui-warning, --ui-tone-foreground, --ui-overlay, --ui-tint-strength
shape--ui-radius-sm, --ui-popup-radius, --ui-surface-radius
control--ui-control-height, --ui-control-padding-x, --ui-control-gap, --ui-icon-size
type--ui-font-mono, --ui-font-display
include--ui-shadow-resting

An application-wide UtherealProvider supplies defaults.

Composition

In an agent composition, UsagePricing is a leaf block. Order plans from smallest to largest capacity, keep seatStops and trafficStops ascending and unique, and wire startAction to a registered host action. See Building with agents.

{
  "type": "UsagePricing",
  "props": {
    "title": "Estimate your monthly API spend",
    "defaultSeats": 25,
    "defaultTrafficMillions": 20,
    "defaultInterval": "yearly",
    "startAction": "start_usage_trial"
  },
  "children": []
}

On this page