Skip to content

Usage-Based Pricing Slider

Tailwind CSS pricing card with a range slider that updates the plan, monthly price and cost per 1,000 requests as usage changes.

Also known as: pricing calculator slider, price slider, usage pricing calculator, pay as you go pricing

Tailwind CSS Pricing Tables Responsive Dark #card #pricing #range #saas #slider

Usage-Based Pricing Slider live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A usage-based pricing card built with Tailwind CSS and a few lines of vanilla JavaScript: visitors drag a slider to pick their monthly API request volume and immediately see the plan name, the monthly price and the cost per 1,000 requests. It suits APIs, email services, hosting and other SaaS products billed by consumption.

How it works

The root is section.ups-pricing. All pricing data lives in data attributes on that element: data-ups-volumes lists the volume steps, data-ups-prices the matching monthly prices and data-ups-plans the plan name for each step. The card is a grid that splits into a dark slider panel and a lime feature panel from the md breakpoint; on phones the panels stack.

The slider is a native input type="range" with the class .ups-range. Its value is an index into the lists, so the steps can be unevenly spaced while the thumb moves in equal steps. On every input event the script reads the index, updates the output element marked data-ups-volume, the data-ups-plan badge, the data-ups-price amount and the data-ups-rate line, and changes the data-ups-cta button text. A price that is not a number, such as custom on the last step, switches the card to a "Custom / Talk to sales" state.

style.css styles the range track with a gradient whose stop is the --ups-fill custom property; the script sets it to the slider position so the filled part follows the thumb. Without JavaScript the markup still shows a correct 100,000 request price.

Customization

  • data-ups-volumes and data-ups-prices on .ups-pricing: replace with your own tiers; keep both lists the same length. The script sets the slider max automatically.
  • data-ups-plans: rename the tiers shown in the badge, e.g. Free,Pro,Team.
  • data-ups-unit: change "requests" to "emails", "GB" or "seats" in the rate line and screen reader text.
  • value="3" on #ups-range: choose the step that is selected on page load (also update the static text and the --ups-fill default in style.css).
  • --ups-accent and --ups-track in .ups-range: recolor the filled and empty parts of the track and the thumb ring.
  • bg-lime-400 on the feature panel: swap for another Tailwind color to change the brand accent.
  • The tick labels use left-[37.5%] and left-[75%]; move them to match the index positions of your own steps.

Use cases

  • API products: developers drag a slider to see the monthly price for their request volume
  • Email services: marketers pick a monthly sending volume and see the plan and cost per 1,000 emails
  • Hosting plans: visitors compare tiers as the plan name and price update while they drag
  • Enterprise tiers: the top slider step switches the card to a custom price with a talk to sales button

Accessibility

The slider is a real range input with a visible label, so arrow keys, Page Up/Down, Home and End all work. The script keeps aria-valuetext in sync, so screen readers hear "250,000 requests per month, $79 per month" instead of a bare index. A sr-only region with aria-live="polite" announces the selected plan after a short debounce. The thumb gets a stronger glow on :focus-visible, the CTA has a focus ring, decorative check icons are aria-hidden and thumb transitions are disabled under prefers-reduced-motion.

Usage notes

Requires the Tailwind browser build (added automatically). Several cards can share a page because each .ups-pricing is initialized separately; give every copy a unique id for the range and its label.

Usage-Based Pricing Slider at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile, dark design
Category
Pricing Tables
License
Free for personal and commercial use

Questions about this template

Can I use the Usage-Based Pricing Slider code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Usage-Based Pricing Slider – free Tailwind CSS pricing table template
Usage-Based Pricing Slider · free Tailwind CSS pricing table template

More Pricing Tables

Pricing Cards with Billing Toggle – free Bootstrap 5 pricing table template

Pricing Cards with Billing Toggle

Bootstrap 5 pricing cards with a Monthly / Annual segmented switch that updates prices, savings and yearly totals, plus a highlighted featured plan.

Pricing Table with Feature Tooltips – free Bootstrap 5 pricing table template

Pricing Table with Feature Tooltips

Bootstrap 5 plan comparison table with a highlighted popular plan and info tooltips that explain every feature on hover or keyboard focus.

Pricing with Team Size Range – free Bootstrap 6 pricing table template

Pricing with Team Size Range

Bootstrap 6 per-seat pricing card with a Range slider for team size, volume tiers, a monthly/annual toggle and a live total price.

Dark Pricing Section – free Bootstrap 6 pricing table template

Dark Pricing Section

Dark Bootstrap 6 pricing section with three glass cards, a gradient-bordered recommended plan, a currency Menu and an FAQ link that opens a Drawer with an accordion.

Pricing Comparison Table – free Bootstrap 6 pricing table template

Pricing Comparison Table

Bootstrap 6 feature comparison table across four plans with check icons, a highlighted Pro column, tooltips, a sticky feature column and an Only differences filter.

Pricing Table with Highlighted Plan – free Bootstrap 6 pricing table template

Pricing Table with Highlighted Plan

Bootstrap 6 pricing cards with a raised dark green Most popular plan, gold accents and a team-size Range slider that recalculates every plan's monthly total.