shadcn.io is not affiliated with official shadcn/ui
Rate Limit Table Stats Block for React
A framed table of API endpoints with method badges, calls used against each limit, a bar with a tick at the 80% line and a countdown to each window's reset.
Installation
Overview
A rate-limit table for React with Base UI. Rateful, a tool that meters an API key against its limits, opens with how many endpoints have hit their limit. Under that, one framed table lists six endpoints: the method as an outlined badge and the path, the window (hidden on a phone), how many calls the window has used out of its limit with a bar that carries a tick at the 80% line, and a countdown to the reset. The endpoint that has used its whole limit is the only one with a destructive mark, a cross and the word "Limited". It is a native table built from Badge, Progress, CountdownText, Status and Guides.
FAQ
How do I change the endpoints and their limits?
Edit LIMITS at the top of the file. An endpoint has a method, a path, a window label, the calls used, the limit and resets, the seconds left in the window when the page opens. The shares, the endpoints past the 80% line, the one at its limit and the headline are computed from those. The 80% line is the SOFT constant.
What do the countdowns do?
Each one starts from its row's resets when the page opens and counts down on its own. Nothing here resets itself: when a window reaches zero the countdown stops there and the bar stays as it was, because the table has no server to read a new window from. Until the page is running the cells show dashes, so the server and the browser draw the same thing.
Why is only one row marked?
Passing the 80% line is a warning to act on, so it is a line of text ("Past the 80% line"). Only an endpoint that has used its whole limit is failing calls, so it alone gets the destructive mark, with a cross and the word "Limited" next to it. Colour never carries the state by itself.
Is the table accessible?
Yes. It is a native table with a caption, column headers and the endpoint as the row header. Each bar is a progress bar named with the method, path, the calls used, the limit and the share. The countdown is a time element that speaks its time in full words. Where the table scrolls sideways on a narrow screen, the scroll area is focusable and labelled.
How does it fit on a phone?
The window column drops out below md. The endpoint, the used bar and the countdown stay, and the table scrolls only if the screen is narrower than that.
Why does the frame have a caption under it?
The caption under the frame explains the tick on the bars. The frame sits inside the rails, with its corners marked, and the column keeps its bottom padding because the frame is not a band. The header and the frame fade up once on load, or simply appear when motion is reduced.
Related
- Pro
A gateway usage table where each route shows calls, error rate, a p50-to-p99 latency range on one scale, and a bar for its share of the rate limit.
- Pro
A background-job table where each queue's depth is a bar split into waiting, running and retrying, with the backlog total in the header.
- Pro
A table of services in a tinted frame with sortable column heads, 30-day uptime strips, response times and error rates, and a mark and a word on any service that is down.
- Pro
A log-analytics table of five severity levels with the count, the lines a minute, and a bar whose length is the logarithm of the count, plus a filter that dims the quieter levels.
- Pro
Capacity Threshold Progress Stats
Goals and progressCloud capacity for an infrastructure team, resource bars whose fill weight steps at 70 and 90, with a status mark on anything past 90.
- Pro
A launch countdown for a product event, with days, hours, minutes and seconds in one band, a pause control, and a registration bar for seats still open.