Feature Flag Toggle

A settings row for flipping a feature flag on or off: flag name, optional description and a labeled switch, wired as a controlled React component.

src/registry/ui/feature-flag-toggle.tsx/r/feature-flag-toggle.json

Installation#

bash
npx shadcn@latest add @minidev/feature-flag-toggle

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/feature-flag-toggle.json

Usage#

tsx
import { FeatureFlagToggle } from "@/components/ui/feature-flag-toggle"

export function Example() {
  return (
    <FeatureFlagToggle name="new-checkout" description="Enable redesigned checkout" checked={flag} onCheckedChange={setFlag} />
  )
}

API reference#

FeatureFlagToggle props
PropTypeDefault
name*string-
descriptionstring-
checkedboolean-
onCheckedChange(checked: boolean) => void-
classNamestring-

* required

Dependencies#

npm

React only

Built from

Examples#

All settings page components

Learn more