Command Palette

Search for a command to run...

Dev Tools/Env Editor

Env Editor

Environment variable editor with key-value grid, masked values, and import/export

Open in v0Open in
.env Editor

Overview

An environment variable editor with key-value grid, masked values for sensitive data, and .env file import/export functionality. Perfect for configuration management UIs.

Installation

bunx shadcn@latest add @elements/env-editor

Usage

import { EnvEditor, type EnvVariable } from "@/components/elements/devtools/env-editor";
import { useState } from "react";

export function ConfigEditor() {
  const [variables, setVariables] = useState<EnvVariable[]>([
    { key: "DATABASE_URL", value: "postgres://..." },
    { key: "API_KEY", value: "sk_live_..." },
    { key: "DEBUG", value: "true" }
  ]);

  return (
    <EnvEditor
      value={variables}
      onChange={setVariables}
      masked
    />
  );
}

Props

PropTypeDefaultDescription
valueEnvVariable[][]Current variables
onChange(variables: EnvVariable[]) => void-Change callback
readOnlybooleanfalseDisable editing
maskedbooleantrueMask values by default
classNamestring-Additional CSS classes

EnvVariable Type

interface EnvVariable {
  key: string;
  value: string;
}

File Format Support

Import/export supports standard .env format:

DATABASE_URL=postgres://localhost:5432/db
API_KEY="secret with spaces"
DEBUG=true

Features

  • Key-value grid editor
  • Show/hide masked values per variable
  • Import .env files
  • Export to .env format
  • Add/remove variables
  • Read-only mode