Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Pricing With Calculator Block for React

A receipt that prices itself, for a webhook-delivery service: number steppers for seats, events and days of history drive a live bill that stamps the cheapest plan and itemises what goes past its allowance.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Turn a multi-input price into a receipt buyers can read. A header row says what the block does and lists the plans as a strip of outline pills, with the current recommendation ticked. Below it, one band between the page's rails has the inputs on one side: three Number Inputs with minus and plus steppers for seats, events a month (in thousands) and days of history, each with a one-line hint. On the other side is the receipt, in monospace figures: the recommended plan's base price, then a line each for extra seats, extra events and longer history, with what is included in the plan when nothing is over, and the total a month at display size, rolling with Sliding Number. A stamp, "Recommended: Team", lands on the receipt whenever the cheapest plan changes. The block's one primary Shine Button names the plan. On a phone it moves to a sticky bar with the live total. Built with Number Input, Guides, Sliding Number, Shine Button and Lucide icons, with CSS transitions only. For webhooks, APIs and any product whose bill depends on several limits.

FAQ

How does it choose the recommended plan?

For every plan it works out the whole bill for the numbers typed in: the plan's base price, plus a charge for each seat, each 100K events and each day of history past what that plan includes. The plan with the lowest total is the one stamped. That means the recommendation never jumps to a dearer plan, and the receipt always shows exactly what the stamped plan costs. If two plans tie, the cheaper base wins.

How do I change the plans, the rates and the limits?

Edit the PLANS array: each plan has a base price, what it includes (seats, events in thousands, retention days) and what each unit past that costs (seatRate, eventRate per 100K, dayRate). LIMITS sets each field's minimum, maximum and starting value, and the fields list inside the component holds the labels, hints and step sizes. Each receipt line is rounded to a whole dollar, and the total is the sum of the lines shown, so the receipt always adds up.

What happens if someone types nonsense into a field?

What is typed is kept as text, and the bill uses it clamped to the field's range: an empty or unreadable field counts as the minimum, and a number past the maximum counts as the maximum. The steppers add and subtract one step (100 for events) and stop at the limits. The field itself is a real spinbutton on every base, named by its label.

What do screen readers get?

Each stepper is named, and the plan strip is a list whose current item is marked and reads ", recommended". The stamp is read as "Recommended plan: Team", not the decorative text. A polite live region reads one message after each change: "Recommended plan: Scale. Total $339 a month." The receipt is a description list, so each line is read as a term and its amount.

How do I connect the button to checkout?

The button is a real link and its label names the recommended plan. It's a ShineButton with render set to an a element and nativeButton={false}. Build the href from the typed numbers and the plan's id, for example /signup?plan=team&seats=12&events=1200&days=30, and let your server recompute the bill before it charges anything. On a phone the same link lives in the sticky bar, and the receipt's own button is hidden below md.

What animates, and what happens under reduced motion?

The totals roll to their new amounts, the plan pills change their border with a short transition, and the stamp drops in slightly large and fades to rest each time the recommendation changes. Under reduced motion the stamp and the pills change at once; the totals still change.

  • Pro

    A usage-based bill calculator for a search API: a slider over monthly search volumes sits in one short band, and a meter of what the plan covers and what is billed as overage rolls the estimated bill beside it.

  • Pro

    A seat calculator: a slider sets the team size with its count riding the thumb, ticks at the 10, 25 and 50 seat discounts, shortcuts to them, and a panel that rolls the seat price and monthly total.

  • Pro

    An itemised monthly bill for an accounting suite: full-width ledger rows with quantities, a subtotal, the annual discount and the total, which a billing switch recalculates, beside the plan it adds up to.

  • Pro

    An ROI calculator for a workflow-automation tool: sliders for team size and hours saved a week feed one display-size figure, the net savings a month, with the value of the time, the seat cost and the return under it.

  • Pro

    Tiered API Pricing

    Comparison tables

    API tiers by request quota, with the quota as the headline: four columns open with 10k, 250k, 2M and 10M+ requests a month at display size, then the price, the overage rate and a call to action, over grouped limits and features.

  • Pro

    Pay As You Go Pricing

    Usage and credits

    Usage pricing for a serverless platform as rate rows: each billable resource with its free allowance, its starting rate at display size and the two volume steps that lower it, with one call to action in the header.