# Plan and usage

- **[App UI](/app/)**
- **[Billing](/app/billing/)**
- **Plan and usage**

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…

## 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

- **[App, invoice list](/blocks/app/billing-invoices)**
- **[App, profile settings](/blocks/app/settings-profile)**
- **[App, member list](/blocks/app/team-members)**

## 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 AppBillingPlan from '@/components/klarhimmel/blocks/app-billing-plan';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppBillingPlan props={{
          "eyebrow": "Billing",
          "title": "Your plan",
          "description": "Say what the plan covers and how much of it is used.",
          "plan": {
            "name": "Name it",
            "badge": "Current plan",
            "price": "$00",
            "interval": "per month"
          },
          "features": [
            "Say the first limit",
            "Say the second limit",
            "Say the first extra included",
            "Say the support included"
          ],
          "of": "in",
          "usage": [
            {
              "label": "Name a limit",
              "used": "12",
              "limit": "15",
              "unit": "units"
            },
            {
              "label": "Name another limit",
              "used": "1840",
              "limit": "2000",
              "unit": "items"
            }
          ],
          "warnLimit": "Getting close",
          "nearLimit": "Almost full",
          "overLimit": "Over the limit",
          "manage": {
            "label": "Manage billing",
            "href": "#manage"
          },
          "upgrade": {
            "label": "Upgrade plan",
            "href": "#upgrade"
          },
          "state": "active",
          "notices": {
            "trial": "Say when the trial ends and what to do to keep what they have.",
            "pastDue": "Say the payment failed and what to update to stay online."
          }
        }} />
      </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.

- **eyebrow**: Text, up to 60 characters. Optional; empty is not rendered.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters. Optional; empty is not rendered.
- **plan**: Fields: name, badge (optional), price, interval.
- **features**: List of 2 to 6.
- **of**: Text, up to 10 characters.
- **usage**: List of 1 to 4. Each item: label, used, limit, unit.
- **warnLimit**: Text, up to 40 characters.
- **nearLimit**: Text, up to 40 characters.
- **overLimit**: Text, up to 40 characters.
- **manage**: See the type.
- **upgrade**: See the type.
- **state**: One of 'active', 'trial', 'pastDue'.
- **notices**: Fields: trial, pastDue.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-billing-plan
  ```

Uses

- 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.
