Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Usage Slider Pricing Block for React

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.

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

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 render set to an a element and nativeButton={false}. 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.

What happens on a phone?

The slider band keeps its short height, the meter and the itemised bill follow, and a sticky bar at the bottom of the section holds the estimated bill and the button, so you can drag and watch the price without scrolling. The feature cells stack into one column.

Why is the slider grey?

The primary colour marks one control per block, here the call to action. The slider's fill and thumb use the foreground colour instead, so they read in every theme and in dark mode.

  • Pro

    A monthly estimate for Light, Standard and Heavy usage of a speech-to-text API: choosing a profile rolls the total, resizes a tall stacked bar of where the bill comes from and updates each cost line.

  • Pro

    Overage Pricing

    Usage and credits

    Overage pricing drawn as an area chart: pick a plan and see its monthly bill against the gigabytes ingested, a flat shaded block for the allowance and a rising wedge for every extra gigabyte, beside the price and a table of allowances.

  • Pro

    A 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 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

    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

    Credit Packs Pricing

    Usage and credits

    One-time credit packs where the amounts lead: 500, 2,000, 10,000 and 50,000 credits at display size over growing coin stacks, each pack cheaper per credit, rows with a buy button on phones.