p-switch-3

PreviousNext

Switch with description

Docs
cossblock

Preview

Loading preview…
registry/default/particles/p-switch-3.tsx
import * as React from "react";

import { Label } from "@/registry/default/ui/label";
import { Switch } from "@/registry/default/ui/switch";

export default function Particle() {
  const id = React.useId();

  return (
    <div className="flex items-start gap-2">
      <Switch defaultChecked id={id} />
      <div className="flex flex-col gap-1">
        <Label htmlFor={id}>Marketing emails</Label>
        <p className="text-muted-foreground text-xs">
          By enabling marketing emails, you agree to receive emails.
        </p>
      </div>
    </div>
  );
}

Installation

npx shadcn@latest add @coss/p-switch-3

Usage

import { PSwitch3 } from "@/components/p-switch-3"
<PSwitch3 />