shadcn.io is not affiliated with official shadcn/ui
Usage Limits Settings Block for React
A row for each resource with a usage bar, a limit field, a policy for what happens at the limit (default, block, throttle or bill extra) and a sentence that restates the outcome, plus a default every row can follow.
Installation
Overview
Let admins decide what happens when a workspace runs out, with this usage limits panel for React with Base UI. Inside a hairline frame with a plus mark on each corner, a row for each resource (API calls, storage, seats, projects and exports) shows how much is used in words and in a Progress bar, a Number Input for its limit and a Segment Group for what happens at the limit: Default, Block, Throttle or Bill extra. Under every row a sentence says what that policy does at that limit ("At 10 seats, inviting the 11th person is blocked."), notes when the resource is already at or over it, and says which default a row on Default follows; the Native Select in the header sets that default, so changing it rewrites those sentences at once. The band's count says how many resources have reached their limit, and the last band counts unsaved changes in a status line beside a Shine Button to save them and an outline Button to discard them. On a phone each row stacks and the action foot stays pinned to the bottom of the screen. It's built from Progress, Number Input, Segment Group, Native Select, Button, Shine Button and Guides, with a CSS entrance only. For SaaS admin pages, usage-based products and any limit that needs a stated consequence.
FAQ
How do I fill it with my own resources?
Edit RESOURCES. Each has an id, a name, a unit for the figures ("seats", "GB", "calls a month"), how much is used, the range its limit may take, and three sentences: what Block, Throttle and Bill extra do at the limit, with {limit} and {next} (the next ordinal, as in 11th) filled in. SAVED is what the account has stored: the default policy, each limit and each row's policy. The sentences, the bars and the counts are all worked out from those.
What does Default mean on a row?
A row on Default follows the select in the header: its sentence ends with the default in brackets ("default: block") and changes when you change the select. Choosing Block, Throttle or Bill extra on a row pins it, and the select no longer affects it. The select's own choices are the three policies; Default is only a row's way of saying it follows it.
What if a limit is set below what is already used?
The bar fills, the count in the header says the resource has reached its limit, and the row's sentence starts with what is true now ("Already over by 2.") before it says what the policy does from here. Nothing is refused: the field accepts any value in its range, so an admin can lower a limit ahead of a clean-up.
What stays local, and how do I wire it for real?
Everything: the usage figures and prices are typed, nothing is enforced and nothing is billed. Save keeps the settings in this page and says so. To make it real, load each resource's usage from your metering, send the saved limits and policies to the service that enforces them, and take the prices in the "Bill extra" sentences from your price list rather than typing them.
How are the rows labelled?
Each row is an item in a labelled list. The usage bar is decorative and named with the same words as the text beside it ("Seats: 7 of 10 seats"); the limit field is named "Seats limit" and the policy group "Seats, at the limit", with the arrow keys moving between its segments. Save and Discard stay focusable while nothing changed, marked aria-disabled, and say so when pressed.
How does it look on a phone?
Each resource becomes a stack: its name and use with the bar, the limit field at full width, the four policies across the width, and the sentence, which reserves three lines so a longer one never moves the rows under it. The header's select drops under the sentence and the foot stays pinned to the bottom of the screen.
Related
- Pro
API Rate Limit Tiers Settings
API and webhooksA matrix of API limits with the plans across and a number field in every cell, a daily capacity worked out under each plan and a guard that stops a higher plan from allowing less than the plan before it.
- Pro
Usage Meters Billing
Plan and usageUsage meters for an app's settings: one row per quota with its count, a bar that turns to a warning tone at 80% and an over-limit tone past 100%, and a plain line on what happens next.
- Pro
Limit Reached Billing
Upsell and retentionThe upgrade prompt shown where someone hits a plan limit: what was blocked, the limit reached against the next plan's, a two-column comparison and Upgrade or Remind me later.
- Pro
Usage Alerts Billing
Plan and usageUsage alert settings: percentage thresholds as switches with number inputs, recipients as email chips, and a choice between email and a webhook, with a save that checks them.
- Pro
Content Moderation Settings
Product controlsA moderation rules window: a rail of four rules, an editor with action, sensitivity and blocked words, and a tester that runs a typed comment through the rules and marks what matched.
- Pro
Maintenance Mode Settings
Product controlsA maintenance mode settings page you edit in place: a slim admin bar with the switch, the window and a bypass popover, over the visitors' page drawn with a headline and message you click to edit, or the live store when it is off.