Skip to content
Klarhimmel UI

Pricing, billing toggle

Pricing, billing toggle previewPricing, billing toggle preview

Install

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

Up to three plans with a monthly and yearly switch that changes every price. Both prices show while editing.

Import

Import

import Block from '@/components/klarhimmel/blocks/pricing-toggle';
Also called
  • pricing/toggle
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

Up to three plans with a monthly and yearly switch that changes every price at once. Use pricing-tiers when you offer one billing period only.

Writing for it

- Each tier carries a monthly and a yearly price of 16 characters each. Write the yearly figure as the monthly equivalent if the period says 'per month'. - The saving badge (32 characters) is drawn on the yearly button, such as 'Save 20%'. Empty it and the badge disappears. - The monthly label is required, and yearly and monthly labels are also the accessible name of the switch. Use plain words like 'Monthly' and 'Yearly'.

Watch out for

The page always loads on monthly, and only a visitor can switch it. In the canvas both prices are shown and the toggle is a static label, so a screenshot of the published page may show different numbers than your editor.

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 PricingToggle from '@/components/klarhimmel/blocks/pricing-toggle';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <PricingToggle props={{
          "eyebrow": "Section name",
          "title": "Say how billing can be chosen",
          "description": "Say in one sentence what every plan includes and what the choice is about.",
          "monthlyLabel": "Monthly",
          "yearlyLabel": "Yearly",
          "saving": "Save 00 %",
          "tiers": [
            {
              "name": "First plan",
              "monthly": "$00",
              "yearly": "$00",
              "period": "billing period",
              "description": "Say who this plan suits in one line",
              "features": [
                "Name a first feature",
                "Name a feature"
              ],
              "cta": {
                "label": "Main action",
                "href": "#start"
              },
              "featured": false
            },
            {
              "name": "Second plan",
              "monthly": "$00",
              "yearly": "$00",
              "period": "per unit, per period",
              "description": "Say who this plan suits in one line",
              "features": [
                "Name a first feature",
                "Name a second feature"
              ],
              "cta": {
                "label": "Main action",
                "href": "#trial"
              },
              "featured": true
            }
          ]
        }} />
      </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 how billing can be chosen'Text, up to 120 characters.
descriptionstring'Say in one sentence what every plan…'Text, up to 300 characters.
monthlyLabelstring'Monthly'Text, up to 24 characters.
yearlyLabelstring'Yearly'Text, up to 24 characters.
savingstring'Save 00 %'Text, up to 32 characters.
tiers{ name, monthly, yearly, period, description, features, cta, featured }[]3 itemsList of 1 to 3. Each item: name, monthly, yearly, period, description, features, cta, featured.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.