p-switch-4

PreviousNext

Switch card

Docs
cossblock

Preview

Loading preview…
registry/default/particles/p-switch-4.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 (
    <Label
      className="flex items-center gap-6 rounded-lg border p-3 hover:bg-accent/50 has-data-checked:border-primary/48 has-data-checked:bg-accent/50"
      htmlFor={id}
    >
      <div className="flex flex-col gap-1">
        <p>Enable notifications</p>
        <p className="text-muted-foreground text-xs">
          You can enable or disable notifications at any time.
        </p>
      </div>
      <Switch defaultChecked id={id} />
    </Label>
  );
}

Installation

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

Usage

import { PSwitch4 } from "@/components/p-switch-4"
<PSwitch4 />