Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Environment Variables Settings Block for React

An environment variables settings panel that shows where each variable is set across Production, Preview and Development, counts what is missing, fills a missing value with Copy from, and previews a pasted .env file before it imports.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Answer the question every deploy asks, where is each variable set, with this environment variables settings panel for React with Base UI. A hairline frame with a plus mark on each corner opens with a strip that counts what is missing in Production, Preview and Development, and a heading that says "2 variables are missing in Production". A native table has a row per variable and a column per environment: each cell is Set, with a value masked as bullets, a reveal toggle named for the variable and the environment and a mark on secrets, or Missing, with a Copy from button that fills it from the first environment that has a value. A paste band takes the lines of a .env file, an environment in a Segment Group and a Textarea, skips comments, and says "Adds 3, updates 1, skips 1" with the reason for each skipped line before anything is imported; Use a sample fills it in. The foot's Shine Button imports, and a variable that was new appears in the table, missing everywhere else. On a phone each variable is a card with a line per environment. It's built from Segment Group, Textarea, Field, Button, Shine Button and Guides, with a CSS entrance only. For a hosting dashboard, a deploy settings page or any app with per-environment configuration.

FAQ

How do I fill it with my own variables?

Edit VARIABLES at the top: each has an id, its name, whether it is a secret, and a value for each environment (empty when it is missing there). ENVIRONMENTS lists the columns and SOURCES is the order "Copy from" looks in. The strip's counts, the sentence in the heading, the label on each Copy from button and the import summary are all worked out from the data, so nothing is typed twice. The values here are fictional; your API should send back only whether a secret is set, not the secret.

How is a pasted .env file read?

Each line is trimmed, a leading export is dropped, blank lines and lines starting with # are ignored, and the text before the first = is the name and the rest the value, without its quotes or a trailing comment on an unquoted value. A name must start with a letter or an underscore and use only letters, digits and underscores. For the chosen environment a name that isn't set there is an add, one that is set to a different value is an update, and a repeated name, an unchanged value, an invalid name or a line with no equals sign is skipped, with the line number and the reason under the summary. Nothing changes until you press Import.

What stays local, and how do I make it real?

Everything. Copy from, Import and the reveal toggles only change this page's state, and the status line says what happened; no value is sent or stored, and nothing is read from a file. To make it real, send the import's entries to your API in the submit handler and refresh the list from its answer, and keep the reveal behind a request so a secret's value only leaves the server when someone asks for it. A name new to the table shows as missing in the other environments, which is the point of the strip.

What does Copy from do?

It fills the missing cell with the value from the first environment that has one, looking at Preview, then Production, then Development, and the button is named for what it does ("Copy from Preview for MAILER_API_KEY in Production"). The cell then shows Set and the focus moves to its reveal toggle, so the keyboard doesn't lose its place, and the strip and the heading update. Every cell keeps the same height whether it is set or missing, so nothing moves when you fill one in.

How does it look on a phone, and is it accessible?

Below the medium breakpoint the table becomes a card per variable with one line per environment, the paste band and the foot stack, and the Import button is pinned to the bottom of the screen. The table is native, with a caption, column headers and the variable's name as each row's header; the reveal toggles are buttons that report whether the value is shown, and the status line is a polite live region present from the start. Set and Missing are shown with a filled and a hollow dot as well as the word, never by colour alone.

  • Pro

    A table of environment variables whose values stay masked until you show them, with scope tabs, a reveal toggle and a copy button per row, and Reveal all and Hide all.

  • Pro

    A build settings panel for a static-site host: a preset fills the folder and commands, and a dark terminal writes the build log from the fields, or stops at the error a real runner would give.

  • Pro

    A feature flag settings panel with ordered targeting rules, a kill switch that asks first, and an Evaluate for a user pane that reads what the flag serves and which rule decided.

  • Pro

    API Key Builder Settings

    API and webhooks

    An 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

    A 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

    Cache Policy Settings

    Domains and delivery

    An ordered table of cache rules where first match wins: each path pattern has a freshness bar, how long a copy stays fresh and how long a stale one may be served, a count of the cached paths it really claims, and a purge that counts what it would clear.