Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Pricing sections

3 examples. Resize any preview to see it at phone and tablet widths.

Pricing Plans

Free

Three tiers with a monthly/yearly switch that rolls the prices, a per-seat stepper on the team plan, and an expandable feature comparison table.

Usage Calculator

Free

A metered API plan with an adjustable request volume, itemized usage and monthly estimate.

Hide code
components/blocks/pricing-usage.tsx
"use client";

import { useId, useState } from "react";

const volumes = [10_000, 25_000, 50_000, 100_000, 250_000, 500_000];
const number = new Intl.NumberFormat("en-US");

export default function PricingUsage() {
  const id = useId();
  const [step, setStep] = useState(2);
  const requests = volumes[step];
  const usage = (requests - volumes[0]) / 1000 * 0.5;

  return (
    <section className="mx-auto w-full max-w-5xl px-5 py-14 sm:px-10 sm:py-20">
      <p className="text-sm font-medium text-muted-foreground">Relay API pricing</p>
      <h2 className="mt-3 max-w-2xl text-balance text-4xl font-medium tracking-[-0.05em] sm:text-6xl">A plan that fits your traffic.</h2>
      <div className="mt-9 grid overflow-hidden rounded-xl border border-border bg-card md:grid-cols-[1.4fr_1fr]">
        <div className="p-6 sm:p-9">
          <label htmlFor={id} className="font-medium">Monthly requests</label>
          <p className="mt-3 font-mono text-4xl tabular-nums">{number.format(requests)}</p>
          <input id={id} type="range" min={0} max={volumes.length - 1} value={step} aria-valuetext={`${number.format(requests)} requests`} onChange={(event) => setStep(event.currentTarget.valueAsNumber)} className="mt-5 h-8 w-full cursor-pointer accent-foreground focus-visible:outline-ring" />
          <div className="flex justify-between font-mono text-xs text-muted-foreground"><span>10k</span><span>500k</span></div>
          <p className="mt-7 max-w-sm text-sm leading-relaxed text-muted-foreground">Your first 10,000 requests are included. Each additional thousand costs $0.50.</p>
        </div>
        <div className="bg-[#302923] p-6 text-[#fff6ea] sm:p-9">
          <h3 className="text-sm">Monthly estimate</h3>
          <output htmlFor={id} className="mt-2 block font-serif text-6xl tabular-nums">${20 + usage}</output>
          <dl className="mt-6 space-y-2 border-t border-white/30 pt-4 text-sm">
            <div className="flex justify-between"><dt>Base plan</dt><dd>$20</dd></div>
            <div className="flex justify-between"><dt>Additional usage</dt><dd>${usage}</dd></div>
          </dl>
        </div>
      </div>
    </section>
  );
}

Plan Comparison

Pro

A feature-by-feature plan table with grouped rows, a highlighted plan and a feature column that stays in view while the table scrolls sideways on phones.

The source for this block is part of Truffle Pro.