Ballmac UI home

Env Editor

A .env editor with masked values, show and hide, name validation and duplicate detection, paste-to-import for whole .env files, and copy as .env.

Environment variables

Available to builds and at runtime in Production.

Installation

$ pnpm dlx shadcn@latest add @ballmac/env-editor

Usage

import { EnvEditor, parseEnv, formatEnv } from "@/components/ballmac/env-editor"

The full example is in the Code tab above.

Examples

Controlled with a live .env preview

Staging variables

3 variables · 3 to fix

  • This name is used more than once.

  • This name is used more than once.

  • Use letters, numbers and underscores, and don't start with a number.

API_URL=https://api.example.com
API_URL=https://staging.example.com
3RD_PARTY_KEY=abc

API reference

PropTypeDefault
value

Variables (controlled).

EnvVariable[]—
defaultValue

Initial variables when uncontrolled.

Omit<EnvVariable, "id">[][]
onChange

Called with the new list after every change.

(variables: EnvVariable[]) => void—
maskAll

Names whose values are shown masked until revealed. Defaults to every row.

booleantrue
title

Title shown above the rows.

string—
description

Helper text under the title.

string—
disabled

Disables editing, for read-only views.

booleanfalse

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabName, value, show/hide, remove for every row, in order
Screen readersInputs are named 'Name of variable 2' and 'Value of API_KEY'; problems are linked with aria-describedby; add and remove are announced
FocusA new row focuses its name; removing focuses the row above

Use with AI

Uncontrolled with defaultValue [{ key, value }] or controlled with value [{ id, key, value }] and onChange. Pasting KEY=value lines into a name field, or into the Paste .env box, imports them. parseEnv and formatEnv are exported. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Env Editor (@ballmac/env-editor) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Project or deployment settings pages
  • Anywhere people manage secrets as key and value pairs

Not for

  • Structured settings with types (settings-panel)
  • A single secret (api-key-field)

Registry JSON: https://ui.ballmac.com/r/env-editor.json

Credits

Free to use in personal and commercial projects.