Plan and usage


Install
npx shadcn add @klarhimmel/app-billing-planDetailsAbout, usage, props and more
The current plan on one card: name, price, what is included, usage meters (native meter elements; the band is said in words at 70%, 90% and over the limit, and a limit…
States
plan and usage in 4 forms: active, trial, pastDue, over the limit and unlimited.
state: active
Billing
Your plan
Say what the plan covers and how much of it is used.
Say when the trial ends and what to do to keep what they have.Say the payment failed and what to update to stay online.Name it
Current plan- Say the first limit
- Say the second limit
- Say the first extra included
- Say the support included
$00per month
12 in 15 unitsOver the limitAlmost fullGetting close
1840 in 2000 itemsOver the limitAlmost fullGetting close
state: trial
Billing
Your plan
Say what the plan covers and how much of it is used.
Say when the trial ends and what to do to keep what they have.Say the payment failed and what to update to stay online.Name it
Current plan- Say the first limit
- Say the second limit
- Say the first extra included
- Say the support included
$00per month
12 in 15 unitsOver the limitAlmost fullGetting close
1840 in 2000 itemsOver the limitAlmost fullGetting close
state: pastDue
Billing
Your plan
Say what the plan covers and how much of it is used.
Say when the trial ends and what to do to keep what they have.Say the payment failed and what to update to stay online.Name it
Current plan- Say the first limit
- Say the second limit
- Say the first extra included
- Say the support included
$00per month
12 in 15 unitsOver the limitAlmost fullGetting close
1840 in 2000 itemsOver the limitAlmost fullGetting close
over the limit and unlimited
Billing
Your plan
Say what the plan covers and how much of it is used.
Say when the trial ends and what to do to keep what they have.Say the payment failed and what to update to stay online.Name it
Current plan- Say the first limit
- Say the second limit
- Say the first extra included
- Say the support included
$00per month
2 500 in 2,000 messagesOver the limitAlmost fullGetting close
5 seats · UnlimitedOver the limitAlmost fullGetting close
Notes
When to use it
One card showing the plan an account is on, what it includes and how much of each limit is used. For the history of payments use app-billing-invoices; for choosing between plans a pricing block fits better.
Writing for it
- usage takes 1 to 4 meters with used and limit as numbers written as text (12 characters). Write 1 800 or 1,840; the component parses them to draw the meter.
- A limit such as Unlimited has no number, so it draws no meter and never warns. Use that on purpose for plans without a cap.
- Fill warnLimit, nearLimit and overLimit (40 each) with the words said at 70%, 90% and over 100%, so a nearly full meter is not only a colour.
Watch out for
The notice text under notices is shown only for the trial and pastDue states, and nothing is shown for active, so the state alone controls which warning appears. Features need at least 2 and at most 6 entries of 80 characters.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
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.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Billing' | Text, up to 60 characters. Optional; empty is not rendered. |
title | string | 'Your plan' | Text, up to 120 characters. |
description | string | 'Say what the plan covers and how mu…' | Text, up to 300 characters. Optional; empty is not rendered. |
plan | { name, badge, price, interval } | {…} | Fields: name, badge (optional), price, interval. |
features | string[] | 4 items | List of 2 to 6. |
of | string | 'in' | Text, up to 10 characters. |
usage | { label, used, limit, unit }[] | 2 items | List of 1 to 4. Each item: label, used, limit, unit. |
warnLimit | string | 'Getting close' | Text, up to 40 characters. |
nearLimit | string | 'Almost full' | Text, up to 40 characters. |
overLimit | string | 'Over the limit' | Text, up to 40 characters. |
manage | Link | {…} | See the type. |
upgrade | Link | {…} | See the type. |
state | 'active' | 'trial' | 'pastDue' | 'active' | One of 'active', 'trial', 'pastDue'. |
notices | { trial, pastDue } | {…} | Fields: trial, pastDue. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |
Install
Installs
- Badge
- Banner
- ButtonLink
- About
- The current plan on one card: name, price, what is included, usage meters (native meter elements; the band is said in words at 70%, 90% and over the limit, and a limit without a number such as Unlimited draws no meter), and manage and…
- States
- Active, trial and past due. Usage meters warn at 70% and are critical at 90%, and say so in words. New project? Set it up once: /get-started/installation.