Controlled Switch

PreviousNext

A controlled switch component

Docs
shadcnui-blockscomponent

Preview

Loading preview…
components/customized/switch/switch-06.tsx
"use client";

import { Switch } from "@/registry/ui/switch";
import React, { useState } from "react";

const ControlledSwitchDemo = () => {
  const [checked, setChecked] = useState<boolean>();

  return <Switch checked={checked} onCheckedChange={setChecked} />;
};

export default ControlledSwitchDemo;

Installation

npx shadcn@latest add @shadcnui-blocks/switch-06

Usage

import { Switch06 } from "@/components/switch-06"
<Switch06 />