# Env Vars Editor

> The environment variables editor from a deploy dashboard. Names clean themselves to UPPER_SNAKE and flag clashes in the same environment; values stay masked with a reveal, and sensitive ones lock for good once saved. Chips set each row's environments. Paste a whole .env into any name field, or drop the file, to import it. Remove with undo, filter by name, and save with ⌘S.

- Slug: `env-vars-editor`
- Category: [Forms](https://www.assembli.design/category/forms.md)
- Type: component
- Tags: env, environment-variables, secrets, developer, settings, dotenv, key-value, form
- npm dependencies: lucide-react, motion
- shadcn/ui dependencies: none
- Live preview: https://www.assembli.design/preview/env-vars-editor
- Page: https://www.assembli.design/components/env-vars-editor

![Env Vars Editor preview](https://www.assembli.design/thumbnails/env-vars-editor-light.png)

## Props

Other props pass through to the root element.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `EnvVar[]` | `[]` | The saved variables. Sensitive ones can come back with an empty value. |
| `environments` | `EnvEnvironment[]` | `DEFAULT_ENVIRONMENTS` |  |
| `onSave` | `(vars: EnvVar[]) => Promise<unknown> \| void` |  | Persist the variables. Resolve to commit them; reject to keep the changes and show an error. |
| `onValueChange` | `(vars: EnvVar[]) => void` |  | Called on every edit with the current rows, blank rows included. |
| `title` | `React.ReactNode` | `"Environment variables"` |  |
| `description` | `React.ReactNode` | `"Encrypted at rest and injected at build and runtime. Chang…` |  |
| `undoSeconds` | `number` | `6` | Seconds the undo strip stays after a removal or import. |

## Install

One-time setup (needs a subscription):

1. Add the registry to the project's `components.json`: `{"@assembli":{"url":"https://www.assembli.design/r/{name}.json","headers":{"Authorization":"Bearer ${ASSEMBLI_API_KEY}"}}}` (merge into `"registries"`).
2. Put an API key from https://www.assembli.design/account in `.env.local` as `ASSEMBLI_API_KEY=asm_…`.

Then install with the shadcn CLI (writes `components/env-vars-editor/env-vars-editor.tsx` and installs dependencies):

```bash
npx shadcn@latest add @assembli/env-vars-editor
```

Registry item JSON: https://www.assembli.design/r/env-vars-editor.json (send `Authorization: Bearer <api key>`)

## Code

> Component source needs an Assembli subscription ($12/month or $96/year) and an API key sent as `Authorization: Bearer <key>`. To get one without copying anything, POST https://www.assembli.design/api/agent/login (or call the MCP tool connect_account), show the user the link it returns, and poll https://www.assembli.design/api/agent/token for the key. Or subscribe at https://www.assembli.design/pricing and create a key at https://www.assembli.design/account.
