Skip to content
Klarhimmel UI

Pricing, pay as you use

Pricing, pay as you use previewPricing, pay as you use preview

Install

npx shadcn add @klarhimmel/pricing-usage
DetailsAbout, usage, props and more

Usage-based pricing: a rate card (what is metered, per unit, how much is free) beside a worked example bill with line items and a total, so nobody has to do the sum.

Import

Import

import Block from '@/components/klarhimmel/blocks/pricing-usage';
Also called
  • pricing/usage
About
Usage-based pricing: a rate card (what is metered, per unit, how much is free) beside a worked example bill with line items and a total, so nobody has to do the sum. Use when there is no plan to pick.
Category
Plans and prices: tiers, a single plan, a toggle or a comparison table. New project? Set it up once: /get-started/installation.

Notes

When to use it

Usage-based pricing, with a rate card on the left and a worked example bill with a total on the right, so nobody has to do the sum. Use pricing-tiers when buyers pick a plan instead.

Writing for it

- Each rate needs a name, a price (20 characters) and optionally a unit and an included allowance, such as '1 000 free'. - Make the example lines add up to the total, because the block does not calculate it. Two to five lines of 60 characters with amounts of 20. - Title the example by who it is, such as 'A shop with 400 orders a month', so the total is read as a case and not a promise.

Watch out for

The total and every amount are plain text, so a mistake in the sum will print as written. The rates are required to be two to six, and the cta sits under the bill in the right column only.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import PricingUsage from '@/components/klarhimmel/blocks/pricing-usage';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <PricingUsage props={{
          "eyebrow": "Section name",
          "title": "Say what the price is based on",
          "description": "Say in one sentence what the price covers and what is free.",
          "ratesTitle": "Name the rates",
          "rates": [
            {
              "name": "Name a billed thing",
              "unit": "per unit",
              "price": "$0.00",
              "included": "First 00 free"
            },
            {
              "name": "Name a billed thing",
              "unit": "per unit",
              "price": "$0.00",
              "included": "First 00 free"
            }
          ],
          "exampleTitle": "Name the worked example",
          "exampleLines": [
            {
              "label": "Say what was used, and how much",
              "amount": "$00.00"
            },
            {
              "label": "Say what was used, and how much",
              "amount": "$00.00"
            }
          ],
          "totalLabel": "Name the total line",
          "total": "$00.00",
          "note": "Say what the prices exclude and when the customer is told before being charged.",
          "cta": {
            "label": "Main action",
            "href": "#start"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
eyebrowstring'Section name'Text, up to 60 characters.
titlestring'Say what the price is based on'Text, up to 120 characters.
descriptionstring'Say in one sentence what the price …'Text, up to 300 characters.
ratesTitlestring'Name the rates'Text, up to 60 characters.
rates{ name, unit, price, included }[]4 itemsList of 2 to 6. Each item: name, unit, price, included.
exampleTitlestring'Name the worked example'Text, up to 60 characters.
exampleLines{ label, amount }[]3 itemsList of 2 to 5. Each item: label, amount.
totalLabelstring'Name the total line'Text, up to 30 characters.
totalstring'$00.00'Text, up to 20 characters.
notestring'Say what the prices exclude and whe…'Text, up to 160 characters.
ctaLink{…}See the type.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.