shadcn.io is not affiliated with official shadcn/ui
No API Keys Empty State Block for React
An API platform's first-key page as a split screen: a name, a scope and one Create key button that shows a made-up demo key once with a copy button, then masks it into a one-row list with Revoke, while a drawn gate takes its pin.
Installation
Overview
Turn an empty key list into the first key, with this no API keys empty state for React with Base UI. The page is Sesameway, an API platform: the rails of the page and one band across it are split in two, the drawing first. The drawing is a gate whose hasp lies over its staple, with the pin hole between them only dashed. At the end the heading, one sentence, a name for the key, a scope chosen with a Toggle Group (Read or Write) and the Shine Button, the only colored control, Create key. Creating shows a made-up key once in an Input Group with a Copy Button and says it is not a real key; Done masks it into a one-row list with a Revoke button, and the pin goes into the staple. Revoking pulls the pin out again. The frame is ruled by Guides, the gate is one SVG whose classes change, and everything moves with CSS only. For the first screen of any API, SDK or developer-platform dashboard.
FAQ
What stays in the page, and how do I make it real?
No key is created and nothing is saved. The key is one made-up string kept in the page (its prefix is not any real service's), it opens nothing, and a reload clears the list. To wire it for real, ask your API for a key where the code says so, show what it returns once in the same field, and list the key's prefix and last four characters afterwards; never keep the whole key in the page's state once it has been shown.
Why is the key shown only once?
It is how real key screens work: the full key exists only at creation, so the page shows it in a read-only field with a Copy button, says so, and masks it as soon as you press Done. The list afterwards shows the prefix, four dots and the last four characters. The demo's copy button really writes the made-up key to your clipboard, which is the only thing here that leaves the page, and a polite line says whether it worked.
Does the page change height between the form, the key and the list?
No. The form, the revealed key and the list share one grid cell, so the cell is as tall as the tallest of them and the inactive two stay invisible and out of the tab order. The page is centred, so nothing under the heading may grow; this is why. Focus moves to the new heading after each step, and Start over puts it back on the name field.
What do Read and Write do?
They are the two scopes of the demo key: a line under the group says what each would allow (list and fetch, or also create, change and delete), and the list shows the scope you picked. The group always has one value. Nothing is enforced here, since no real key exists.
What does Revoke do?
It strikes the row through, says "Revoked in this demo" and takes the pin out of the drawing, leaving the hole dashed again. The button stays in the row, quiet and marked as unavailable, so nothing shifts, and focus moves to Start over. Start over, in turn, returns to the empty form with the name cleared.
Related
- Pro
No Webhooks Empty State
Developer toolsAn event relay's empty endpoint list as a builder: a URL, four events to tick, a code window with the JSON body and a curl command, and one Add endpoint button that lists the endpoint and sends a simulated test event.
- Pro
No Environments Empty State
Developer toolsA config manager's empty environment list as three dashed isometric slabs that turn solid one at a time, with an Add variable row that counts variables on each slab and one Shine Button that names the next environment to create.
- Pro
No Error Tracking Empty State
Developer toolsAn error monitor's empty list as an install guide: a code window with npm, pnpm and bun tabs and a copy button, an initialise snippet, a Send a test error button that lists one simulated row, and a calm lake whose ring turns solid.
- Pro
No Deployments Empty State
Developer toolsA deploy platform's first-deployment page as a split screen: an environment, a Skip tests switch and a dark terminal whose command follows them, one Copy command button, and a sample run that lists a first deployment while a drawn balloon fills.
- Pro
No Connected Apps Empty State
Apps and integrationsA connected apps page with nothing connected: three apps to choose from, the scopes the chosen one would ask for (one required, two optional) and a drawn plug that moves toward a wall socket as choices are made, without ever reaching it.
- Pro
No Logs Empty State
Developer toolsA log console window with nothing logged yet: a dashed pipe from an app to a console, four level chips with counts, a Follow switch, a dark console and one Send a test line button that prints the next of twelve typed lines.