Usage

How much of a plan's limits a workspace has used.

Team plan · Nov 1 – Nov 30Renews Dec 1

Tasks

18,420 of 20,000 tasks this period
18,420 of 20,000 tasks this period
Near the limitResets Dec 1

Runs pause until Dec 1. Running work finishes.

AI credits

2,150 of 5,000 credits this period
2,150 of 5,000 credits this period
140 credits on hold

Seats

12 of 12 seats
12 of 12 seats
At the limit

New members join as guests until a seat frees up.

Storage

41 of 100 GB
41 of 100 GB

Webhook calls

1,284,330 calls this period · no limit

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/usage

Usage

import { UsageMeter } from "./ui/uicontext/components/kit/Usage.ts"
export const TaskMeter = <M>(h: Html.H<M>, used: number) =>	UsageMeter(h, {		label: "Tasks",		used,		limit: 20_000,		unit: "tasks",		period: "this period",		resets: "Resets Dec 1",		atLimit: "Runs pause until Dec 1. Running work finishes.",	})

Examples

A spend limit an admin sets

Change or remove the limit; it saves, says so, and refuses a value outside the allowed range.

Monthly spend

1,640 of 2,000 USD this month
1,640 of 2,000 USD this month
Near the limitResets Dec 1

New runs wait until Dec 1. Work already running finishes.

A new limit applies to the next run.

API reference

UsageLimitComponent

Props

UsageLimit props
NameTypeDefaultDescription
agentIdstring—This editor's id for agents, unique on the page: "spend-limit-workspace"
labelrequiredstring—What is counted: "Tasks", "Monthly spend"
scopestring—Whose usage, when there are several: "#design", "Workspace"
usedrequirednumber—How much is used so far
limitrequirednumber | null—The limit; null for no limit
unitrequiredstring—Plural noun: "tasks", "credits", "USD"
periodstring—"this month", "this week", "this session"
heldnumber—Reserved by work in flight, not yet settled: "120 on hold"
warnAtnumber0.8The fraction of the limit that counts as near it; 0.8 by default
resetsstring—When it resets, formatted by the app: "Resets Dec 1"
atLimitstring—What happens at the limit: "New runs pause until the 1st. Running work finishes."
canrequiredCan(["edit", "clear"])—What this person may do: "edit" sets the limit, "clear" removes it (no limit)
minnumber—Bounds for a new limit, also given to the native input
maxnumber—The largest limit allowed
stepnumber—The step a new limit moves in
notestring—Said under the editor: "Changing a limit applies to the next run."
outcomeOutcome—The app's answer to the last change: "limit" for RequestedLimit, "clear" for RequestedClearLimit. Pending shows "Saving…"; a refusal shows its reason.
request{ label, sent }—For people who can't edit: "Request more", and whether a request is already waiting

Events

UsageLimit events
EventPayloadDescription
RequestedLimit{ limit: number }Set this new limit
RequestedClearLimit{}Remove the limit
RequestedMore{}Ask an admin for more: the request button was pressed

Agent actions

What agents can do with UsageLimit
ActionDescription
SubmittedLimitasks firstSet a new limit, in the meter's unit. Name the current limit as the target.
ClickedClearLimitasks firstRemove the limit. Name the current limit as the target.
ClickedRequestMoreAsk an admin for more

UsageMeterView function

Options

UsageMeter options
NameTypeDescription
labelrequiredstringWhat is counted: "Tasks", "Monthly spend"
scopestringWhose usage, when there are several: "#design", "Workspace"
resetsstringWhen it resets, formatted by the app: "Resets Dec 1"
atLimitstringWhat happens at the limit: "New runs pause until the 1st. Running work finishes."
styleStyleExtra StyleX styles for the meter's box

Accessibility

  • Usage is a native <meter> whose text says the figures, and near or at the limit is said in words too.
  • The limit editor is a form with a labelled number input; an invalid limit is announced and marked aria-invalid.

Source