shadcn.io is not affiliated with official shadcn/ui
Failed API Request Notification Block for React
One failed request from an API gateway: a 502 with the endpoint, upstream, time and request id (with a Copy), tabs for the request, the response and the headers in numbered code windows, and a bounded simulated Retry.
Installation
Overview
Show one failed request so a developer can act on it, with this API error notification for React with Base UI. It is Gatehollow, an API gateway, as a split: at the start, outside the frame, a big 502 drawn for the eye and written out as "Bad gateway" with a Failed Badge, then a Data List of the endpoint, the upstream service, when it failed, how many attempts have been made and the request id with a Copy Button. In the hairline frame at the end three Tabs, Request, Response and Headers, each a numbered Syntax Text window that follows the theme, all the same height. Retry request is a simulated Button: a press waits a moment and says the answer is still 502, up to three attempts in all, after which it says the retries have stopped. Guides draw the frame. For gateways, API consoles and any failure that comes with a request id.
FAQ
How do I show my own request?
Edit PANES (one entry per tab with its text), CODE, ENDPOINT, UPSTREAM, REQUEST and FAILED_AT. The code is shown as typed: nothing is parsed, requested or sent, and the payloads are made-up examples. In your app pass the real request and response text, and mask anything secret before it reaches the page.
What does Retry request do, and why does it stop?
It waits about a second, adds one to the attempt count and says "Attempt 2 of 3: still 502 in this demo." After the third attempt the button says "No retries remain" and pressing it explains that all attempts are used. Nothing is requested: the retries are a simulation, started only by your press and bounded by LIMIT. In your app call your gateway from retry and stop where your policy says.
What does Copy do?
It puts the request id on the clipboard and the status line says "Copied request req_9c41e7a2b8."; if the browser refuses, the button says so. Support asks for this id first, which is why it is in the facts and in the response body.
Do the tabs change the height?
No. Each tab shows its code in a window of the same height that scrolls inside itself when the lines are longer, so switching never moves the status line or the Retry button. Arrow keys move between the tabs and selection follows focus.
Is it accessible?
The code windows are named regions you can focus and scroll with the keyboard, the line numbers are not read or copied with the code, and the 502 is decorative: the failure is also written as "Bad gateway" with a Failed badge. A polite status message reports each retry and each copy.
Related
- Pro
An error tracker's grouped issues in a table: severity as a word and a glyph, event counts and dates, a status menu that updates the word and moves the issue, and an issue that opens to its stack in a numbered code window with a Copy for the event id.
- Pro
Error Toast Notification
ToastsA payments dashboard's charge page with a declined card: an error toast that never times out, a Retry that counts the attempts until the third turns it into Contact support, and the request id with a Copy button.
- Pro
API Uptime Strips Error
Server and outagesA full-screen outage page for an API host: the display 503, a notify-me form that saves in the page, and four APIs as rows of thirty day-cells with a shape and a word for today and an uptime counted from the minutes.
- Pro
Service Dependency Map Error
Server and outagesA full-screen page for one failing service in a marketplace: a framed map of five services joined by hairlines, a radio group that opens each service's panel, and a list of what still works counted from the dependencies.
- Pro
A rate-limit warning with a meter marked at 70, 90 and 100 percent, a 42-second reset countdown you can pause, and a sortable table of the six endpoints behind the traffic with their share as a bar.
- Pro
Alert Banner Notification
Incidents and alertsAn operations console's banner bar over a sketch of its app: four notices queue by urgency and show one at a time, with Previous, Next, a link, Dismiss and Snooze all for an hour.