# API Usage

> An API usage KPI card with a request count and quota progress.

A shadcn/ui block from the [@studio-blocks](https://studio-blocks.arhamkhnz.com/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/studio-blocks/kpi-06).

- Page, with a live preview: https://shadcn.exchange/r/studio-blocks/kpi-06
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/studio-blocks/kpi-06-light-a9f8f4e8aa07aa6b.png
- Registry item: https://studio-blocks.arhamkhnz.com/r/kpi-06.json
- Categories: kpi
- Listed: 2026-10-24, source last changed 2026-10-24

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/studio-blocks/kpi-06.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `lucide-react`
- Registry items: `card`, `progress`

## Files

### `src/registry/blocks/kpi/kpi-06/kpi-06.tsx`

```tsx
import type { ComponentProps } from "react";
import { Waypoints } from "lucide-react";

import { Card, CardAction, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Progress } from "@/components/ui/progress";

export type Kpi06Props = ComponentProps<typeof Card> & {
  title?: string;
  used?: number;
  limit?: number;
};

export function Kpi06({ title = "API requests", used = 24500, limit = 50000, ...props }: Kpi06Props) {
  const usage = Number.isFinite(used) ? Math.max(0, used) : 0;
  const quota = Number.isFinite(limit) ? Math.max(0, limit) : 0;
  const percentage = quota > 0 ? Math.min(100, (usage / quota) * 100) : 0;
  const format = (value: number) => value.toLocaleString("en-US");

  return (
    <Card {...props}>
      <CardHeader>
        <CardTitle className="text-sm font-normal">{title}</CardTitle>
        <CardAction>
          <div className="flex size-7 items-center justify-center rounded-md bg-muted text-muted-foreground">
            <Waypoints aria-hidden="true" className="size-4" />
          </div>
        </CardAction>
      </CardHeader>
      <CardContent className="flex flex-col gap-3">
        <div className="text-3xl leading-none tracking-tight tabular-nums">{format(usage)}</div>
        <Progress
          value={percentage}
          aria-label={`${title} quota usage`}
          aria-valuetext={`${format(usage)} of ${format(quota)} requests used`}
          className="**:data-[slot=progress-indicator]:bg-indigo-500"
        />
        <p className="text-xs text-muted-foreground">
          {format(usage)} of {format(quota)} requests used
        </p>
      </CardContent>
    </Card>
  );
}
```
