field-switch

PreviousNext
Docs
takiexample

Preview

Loading preview…
registry/new-york/examples/field-switch.tsx
import {
  Field,
  FieldContent,
  FieldDescription,
  FieldLabel,
} from "@/registry/new-york/ui/field"
import { Switch } from "@/registry/new-york/ui/switch"

export default function FieldSwitch() {
  return (
    <div className="w-full max-w-md">
      <Field orientation="horizontal">
        <FieldContent>
          <FieldLabel htmlFor="2fa">Multi-factor authentication</FieldLabel>
          <FieldDescription>
            Enable multi-factor authentication. If you do not have a two-factor
            device, you can use a one-time code sent to your email.
          </FieldDescription>
        </FieldContent>
        <Switch id="2fa" />
      </Field>
    </div>
  )
}

Installation

npx shadcn@latest add @taki/field-switch

Usage

import { FieldSwitch } from "@/components/field-switch"
<FieldSwitch />