shadcn.io is not affiliated with official shadcn/ui
Missing API Key Error Block for React
A full-screen page for a developer whose API key is missing: the steps to fix it, and a numbered .env window whose empty key line is marked and can be filled with a sample key that shows as a diff.
Installation
Overview
Tell a developer exactly what is missing, with this missing API key error for React with Base UI. It's a whole screen with the page's rails and one band across it, split by a divider. At the start are the headline, one sentence, the Shine Button Open the API keys page, the only colored control, and three numbered Steps to follow: create a key, add it to .env, restart the dev server. At the end, in a themed window with a numbered gutter, sits the .env file with its empty key line marked by a heavy edge and the word missing. A Copy Button copies the file, and Generate a sample key fills the line with a typed sample and shows the change as a removed line and an added line, with an Undo. The window keeps its height in both states. The band's rules and the window's frame come from Guides, and the entrance is CSS only. For a metrics API, a developer portal or any SDK's getting-started error.
FAQ
What is real here, and what stays local?
The Copy button is real: it writes the file as it stands, with or without the sample line, to the clipboard. Generate a sample key only changes the window in the page: nothing is saved, requested or sent, and the sample is not a credential for anything. To wire it for real, drop the sample and show the line your SDK reports as missing, and send the visitor to your own key page from the one button.
Why is the key marked as not a real key?
A page that prints something that looks like a secret gets copied into real projects and trips secret scanners. The sample is a typed pw_test_demo_ value for a made-up product, it appears with the words "not a real key" next to it, and you should keep your own sample just as obviously fake. A real key is created on your keys page and never shown in an error page.
How does the diff change the file without moving the window?
The window always draws six lines. Before, the sixth is an empty numbered line; after, the key line becomes two lines, the old one struck through and marked with a minus and the new one with a plus. Screen readers get the words Removed and Added, since the signs are decoration, so the window is the same height either way.
Is the code window accessible, and what about right-to-left pages?
The line numbers are hidden from assistive technology, so only the code is read. The window scrolls sideways inside itself when a line is long, it takes a tab stop of its own and is named by its file name, and the code stays left to right in a right-to-left page, as code should. The missing line carries the word missing as well as the edge.
Related
- Pro
Missing Dependency Error
Developer toolsA full-screen page for a missing package: the error line in a copy strip, four install tabs with real Copy buttons, the package card and three steps for after installing.
- Pro
Invalid Config File Error
Developer toolsA full-screen page for a config file that does not validate: a numbered, editable JSON window parsed as you type, the problems located by line and column, and one button that applies the fixes.
- Pro
401 Unauthorized Error
Sign-in and identityA full-screen 401 page for a reporting workspace: the heading, where the visitor was going, Sign in, and a framed list of other ways in where Single sign-on and Email me a link turn their own row into an email field in place.
- Pro
Invalid Token Error
Sign-in and identityA full-screen invalid-token page for an identity API: three ruled checks (Format failed with the parts drawn, Signature and Expiry not checked), a masked fingerprint to copy, Sign in again, and a Report to security list of exactly what a report would attach.
- Pro
CORS Blocked Request Error
NetworkA full-screen page for a cross-origin request the browser blocked: a drawn exchange with the reply's headers and the missing one dashed, the console line in a copy strip, and three fixes with snippets you can copy.
- Pro
Failed Webhook Delivery Error
Developer toolsA full-screen page for a webhook the endpoint rejected: the latest attempt's facts, four expectation checks with a shape and a word, numbered request, response and log windows, and a simulated resend.