shadcn.io is not affiliated with official shadcn/ui
Webhook Endpoints Settings Block for React
A webhook endpoint settings sheet open over the endpoint list: an https URL, an event tree with mixed-state group checkboxes, a signing secret with Roll secret, and recent deliveries where a failed one can be resent with its signature worked out in the browser.
Installation
Overview
Let people choose exactly what an endpoint hears, with this webhook endpoint sheet for React with Base UI. A panel header holds the title and an Edit endpoint Button; under it a drawn list of endpoints, with a switch and a row of blocks for the event types each listens for, and the sheet open over it. The sheet is a Sheet with a Switch that turns the endpoint on or off, an https-only URL field, and a tree of event types in Checkboxes: each group (invoice., customer., payout.*) shows a mixed state while only some of its events are on and ticks or clears the whole group, with a sentence that says how many event types go where. The signing secret is masked to its last four characters; Roll secret makes a new one, shown once with a Copy Button, and says the old one works for 24 hours. The recent deliveries list each event with its status; a failed one has Resend, which turns it to 200 and shows the signature header the receiver would check, an HMAC-SHA256 worked out in your browser. A Shine Button saves the endpoint and the drawing behind updates. On a phone the sheet docks to the foot of the stage. It's built from Sheet, Switch, Checkbox, Input, Badge, Copy Button, Button, Shine Button and Guides, with a CSS entrance only. For an event delivery service, a payments API or any product that calls your servers.
FAQ
Why is the sheet already open, and how do I use the real one?
The page opens with the sheet drawn in place over the endpoint list so the preview shows it, without trapping focus or hiding the page around it. Its Cancel, its Close button and Escape (while focus is inside the stage) close it and move focus to Edit endpoint. Edit endpoint opens the real Sheet with a focus trap, Escape and focus returning to the button, from the side the page reads from. Both share one set of fields and one state, so what you did in place is there in the real one. In your app keep the Sheet and drop the in-place copy.
How do I fill it with my own endpoint and events?
Edit the constants at the top: GROUPS lists the event types by group, SAVED is the endpoint as stored (its address, whether it is on and the events it listens for), SECRETS are the signing secrets a roll hands out in order, and DELIVERIES are the recent deliveries with the code the receiver answered. The group boxes, the "5 of 9 on" counts, the sentence under the heading and the failed count are all worked out from those, so nothing is typed twice.
How do the group checkboxes work?
A group's box looks at its events: ticked when all are on, empty when none are, and mixed in between. Pressing it ticks every event in the group, or, when they were all on, clears them. Each event keeps its own box, and the tree reads in a fixed order so the list never reshuffles. The sentence under the heading restates the subscription, or says that nothing is sent while the endpoint is off or has no events.
What does Resend do, and is the signature real?
Resend marks the failed delivery as answered 200 and says it was resent in this demo, and nothing is delivered. It also shows the signature header a receiver would verify: the HMAC-SHA256 of the timestamp, a dot and the body, keyed with the current fictional signing secret, worked out in your browser by crypto.subtle only when you press the button, then shortened for the page. It needs a secure page; on a page that isn't one, the row says so instead. To make it real, resend from your server and verify the signature there with the secret that endpoint really has.
What does Roll secret do, and what stays local?
It makes the next secret from a short typed list, shows it once in monospace with a Copy button and a Hide it button, and says the old secret works for 24 hours, until the day after the page's fixed date. Closing the sheet hides it for good. Nothing is generated, stored or sent, and Save only changes the endpoint drawn behind the sheet, with a message that nothing was sent. To make it real, roll and save through your API and keep a short overlap in which both secrets verify.
How does it look on a phone, and is it accessible?
On a phone the in-place sheet docks to the foot of the stage with its body scrolling and Save pinned; the real sheet keeps the library's own phone layout. The URL field and its message share one reserved slot, so an error never moves the tree. Every box is named by its event, the switch by what it does, the status badges say delivered or failed in words, and a polite live region present from the start says what changed.
Related
- Pro
API Key Builder Settings
API and webhooksAn API key settings panel with a table of keys, a builder that sets None, Read or Write for each resource, and a try-a-request check that answers Allowed or Denied with the reason before anything is saved.
- Pro
Access Token Hygiene Settings
Sign-in and securityAn access token settings panel that flags risky tokens (no end date, unused for 90 days, the admin scope, ending soon), gives a token an end date from a menu, and revokes the ticked ones after an alert dialog lists them.
- Pro
API Key Dialog
Account and securityA keys page with its create-key dialog shown open: a name, scopes and an expiry in the first step, then the secret shown once, masked behind an eye button, with a Copy button and a box that has to be ticked before Done.
- 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
CORS Allowed Origins Settings
API and webhooksA CORS settings panel that checks its own origin list for four unsafe patterns, each with a Fix button that rewrites the list, plus origin rows with an environment tag, a validating add form and a policy band for credentials and preflight cache.
- Pro
Developer Tools Settings
API and webhooksFour SDK switches and an environment choice beside a request panel they steer: capture lists six requests, choosing one opens its JSON, and debug, verbose errors and timing each add their own part to what it shows.