shadcn.io is not affiliated with official shadcn/ui
Committed Spend Discount Pricing Block for React
Four big commitment chips, $500 to $50k a month, and in the same row the discount each earns at display size, over every unit's committed price against its on-demand price, with the call to action beside the result.
Installation
Overview
Sell usage-based infrastructure on commitments with this committed spend pricing section, shown for Ironbark Cloud, a compute platform. Four chips set at display size ($500, $2k, $10k and $50k a month) are a Segment Group, and the row beside them answers at once: the discount the chosen commitment earns, rolling to its new value with Sliding Number, over a list of what a vCPU-hour, a GB of memory-hour and a GPU-hour cost on demand (struck through) and committed, with how many vCPU-hours the commitment buys and a Shine Button that names the amount. A header row carries the on-demand vCPU rate everything is measured against. The chips and the result share one band ruled by Guides, a divider between them and a + on each corner, under the page's top rule. The chosen chip is raised and outlined; the call to action is the block's only primary element. Built with Guides, Segment Group, Sliding Number, Shine Button and Tailwind CSS, with CSS transitions only. For cloud, compute, API and data platforms that sell committed-use discounts.
FAQ
How do I change the commitments, discounts and units?
Edit COMMITMENTS and UNITS at the top of the file. A commitment has its monthly amount, its discount in whole percent, an id and the chip's big short label. A unit has a name and its on-demand rate. Every committed price is worked out from the rate and the discount (discounted), the headline's "up to" figure is the largest discount, and the hours a commitment buys are its amount divided by the first unit's committed rate, so nothing drifts when you change a number. The selection starts on $2k.
How are the small unit prices written?
rate writes a price with three to five decimals and never a rounding artefact: $0.048 stays $0.048, and $0.0064 at 24% off is $0.00486. The values are left to right and tabular, so the struck on-demand price and the committed price line up row by row. Change maximumFractionDigits in rate if you quote more precision.
Is the chip picker accessible?
Yes. The chips are a radio group named "Monthly commitment": Tab reaches the chosen one and the arrow keys move and select, and each chip reads as its amount, "a month" and its discount ("$2k a month, 15% off"). The discount reads as "15% off" (the number, the percent sign and the word), the struck prices read as "On demand" and the committed ones as "Committed", and nothing is announced while you move between chips, since the result is right there to read.
How do I send the chosen commitment to sales or checkout?
The call to action is a real link. It's a ShineButton with render set to an a element and nativeButton={false}. Build its href from the chosen commitment, for example /commit?amount=2000, and let your server map each amount to a discount in your billing system. Work the discount out again on the server; never trust a price sent from the page.
How does the block fit a phone?
The chips become a two-by-two grid and the result stacks under them, so the call to action lands within the first screen and a half of an iPhone, and at 320 pixels the unit list keeps its three columns. From lg the chips and the result sit in one row, split by a hairline divider. Nothing sits beside the discount, so its width changing as it rolls moves nothing else.
When should I use chips instead of a slider for a commitment?
Use chips when you sell a few fixed commitments, as here: each maps to one discount in your billing system and four choices are quick to compare. When any amount is valid and the discount grows smoothly with it, a slider fits better, as in the contract length slider block.
Related
- Pro
Volume Discount Pricing With a Descending Chart
Seats and teamsPer-seat pricing that falls across four team-size brackets, drawn as a descending bar chart beside compact rows with the saving on each bracket and a call to action per row.
- Pro
Prepaid Credits Pricing
Usage and creditsA top-up picker for prepaid credits: amount chips that show the bonus each earns, a field for any other amount, and the credits you get rolling to a display-size number over a paid-and-bonus bar.
- Pro
Contract Length Slider Pricing
Billing switchesA split pricing section for a VPN with a contract length slider from 1 to 24 months in a card in a card, where the monthly price at display size, the discount, total and savings roll to each term, and a sticky bar on phones.
- Pro
Tiered API Pricing
Comparison tablesAPI 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
Annual Savings Pricing
Billing switchesThree plans that show what yearly billing saves: each plan's head holds two bars, twelve monthly payments against one yearly payment, with the saving printed in the gap, under a monthly and yearly switch.
- Pro
Milestone Discount Pricing
Discounts and offersA slider-driven rate card for usage that gets cheaper at milestones: slide to a monthly volume and the label count rides the thumb, four rate zones show the current one, and the estimate and the next milestone update.