shadcn.io is not affiliated with official shadcn/ui
Usage Slider Pricing Block for Ark UI
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.
Installation
Overview
Let buyers drag to their own volume and read the bill. A header row states the pricing in three short facts (the base plan, what it includes, the rate after that). Below it, one band between the page's rails starts with a short slider across its full width: a Slider over monthly search volumes, with its value in an outline Badge and marked volumes under the track that act as shortcuts. Under it, a meter splits the month's searches into what the base plan covers and what is billed as overage, with the base plan and the overage itemised beneath it, and beside it the estimated bill at display size, rolling with Sliding Number, above the block's one primary Shine Button. What every account gets sits in shared-hairline cells at the foot. On a phone the button rides a sticky bar with the live bill. Built with Slider, Button, Badge, Data List, Guides, Sliding Number, Shine Button and Lucide icons, with CSS transitions only. For APIs, search, email and any product billed per request.
FAQ
How do I change the prices, the quota and the slider's stops?
Edit the constants at the top of the file: BASE_PRICE, INCLUDED (searches the base plan covers) and OVERAGE_RATE (dollars per thousand searches past that). STOPS lists the volumes the slider can land on, closer together at the low end so each step is a similar jump in scale; the slider moves over their indexes. MARKS picks which stops get a shortcut under the track, and START the first one shown. The overage is the searches past the quota, in thousands, times the rate, rounded to a whole dollar; the total is the base plus that.
What does the meter show?
The bar stands for the month's searches. Its solid part is the share the base plan covers, at most INCLUDED, and the lighter part is what is billed as overage, so it shifts toward the lighter tone as you drag past the quota. The legend under it says the same in numbers, "50K of 50K included, 200K past the included". The bar is decorative; the numbers carry the meaning.
Is the slider accessible?
Yes. It is named "Searches a month" and reads its value as words, "1 million searches", rather than an index; the arrow keys, Home, End and Page Up and Down work. The shortcuts under the track are real buttons, each named with its volume. A polite live region reads the volume and the bill after each change.
How do I connect the button to sign-up?
The button is a real link. It's a ShineButton with asChild around an a element. Add the chosen volume to the query, for example /signup?plan=base&volume=250000, so the account starts with a sensible alert threshold. On a phone the same link lives in the sticky bar, and the one in the bill panel is hidden below md.