Env Switcher

React segmented control for switching between Dev, Staging and Prod environments, reporting the selected value. Fits dashboards, API consoles and deploy tools.

src/registry/ui/env-switcher.tsx/r/env-switcher.json

Installation#

bash
npx shadcn@latest add @minidev/env-switcher

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/env-switcher.json

Usage#

tsx
import { EnvSwitcher } from "@/components/ui/env-switcher"

export function Example() {
  return <EnvSwitcher />
}

API reference#

EnvSwitcher props
PropTypeDefault
valuestring"prod"
onChange(v: string) => void-
classNamestring-

Dependencies#

npm

React only
All Developer tool UI components for React