# Usage limits

Plan consumption, reset dates and allowances with exact values and clear limit states.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs plan consumption, reset dates and allowances with exact values and clear limit states.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than usage limits.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Usage limits

```sh
npx shadcn@latest add @tidal-pro/usage-limits
```

Stylesheets: `components/ui/tidal.css`, `components/ui/usage-limits.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/usage-limits.css";
import{TidalUsageLimits}from"./components/ui/usage-limits";
export default()=><div className="tidal-scope"><TidalUsageLimits metrics={[{id:"example",label:"Demo",kind:"metered",value:1,limit:1,valueText:"Demo",limitText:"Demo"}]} title={"Demo"}/></div>;
```

## Structured props

- `TidalUsageLimits.metrics: ReadonlyArray<TidalUsageMetric>`: Required metrics value accepted by this exported component.
- `TidalUsageLimits.title: ReactNode`: Required title value accepted by this exported component.
- `TidalUsageLimits.action?: ReactNode`: Optional action value accepted by this exported component.
- `TidalUsageLimits.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalUsageLimits.emptyMessage?: ReactNode` (default "No usage data to display."): Optional empty message value accepted by this exported component.
- `TidalUsageLimits.headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6" | undefined` (default "h2"): Optional heading level value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/usage-limits.tsx) | [Manifest](https://tidalui.com/examples/usage-limits.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState } from "react";

import { TidalUsageLimits, type TidalUsageMetric } from "./components/ui/usage-limits";

import { TidalButton } from "./components/ui/tidal-button";

import "./components/ui/usage-limits.css";

import "./components/ui/meter.css";

import "./components/ui/status-badge.css";



const tidalExampleStyles = ".tidal-scope .usage-limits-demo {\n  width: 100%;\n  max-width: 640px;\n  min-width: 0;\n}\n.tidal-scope .usage-limits-demo-controls {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  gap: 12px;\n  margin-top: 16px;\n}\n.tidal-scope .usage-limits-demo-controls > span {\n  font-size: 11px;\n  line-height: 1.5;\n  color: var(--t-muted);\n}";

export function UsageLimitsDemo() {
  const [busy, setBusy] = useState(false);
  const metrics: TidalUsageMetric[] = [
    {
      id: "api",
      label: "API requests",
      kind: "metered",
      value: busy ? 48000 : 24580,
      limit: 50000,
      valueText: busy ? "48,000" : "24,580",
      limitText: "50,000",
      reset: { label: "Sample reset · November 1", dateTime: "2026-11-01" },
    },
    {
      id: "storage",
      label: "File storage",
      kind: "metered",
      value: 8.4,
      limit: 10,
      valueText: "8.4 GB",
      limitText: "10 GB",
    },
    {
      id: "projects",
      label: "Projects",
      kind: "unlimited",
      valueText: "12 active",
    },
  ];
  return (
    <div className="usage-limits-demo">
      <TidalUsageLimits
        title="Usage this month"
        description="Sample workspace allowances and consumption."
        metrics={metrics}
      />
      <div className="usage-limits-demo-controls">
        <TidalButton
          variant="secondary"
          aria-pressed={busy}
          onClick={() => setBusy(!busy)}
        >
          {busy ? "Reset sample" : "Show higher usage"}
        </TidalButton>
        <span>Sample data. No billing changes.</span>
      </div>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <UsageLimitsDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned metrics require stable IDs and labels. Metered metrics provide finite nonnegative value/limit numbers for geometry and exact valueText/limitText for display; unlimited metrics provide valueText; unknown metrics may provide a message. Positive limits use the native Meter, zero limits omit its range and show no allowance or exceeded state. Invalid numeric inputs render unavailable without a fabricated amount. warningAt is a clamped0–1 ratio defaulting0.8. Optional description, reset label/dateTime and action per metric; optional outer action, emptyMessage, bounded headingLevel and native section attributes/ref. Exact supplied text remains authoritative while visual meter values clamp to their valid range. Consumers own billing, quotas, reset schedules, arithmetic/formatting and upgrades; no requests or billing changes are made.
