ui/switch.tsx

full-calendar · src/components/ui/switch.tsx · typescript · MIT
ui

Toggle switch UI component with optional icon support

// Source: https://github.com/yassir-jeraidi/full-calendar | License: MIT | Copyright 2025 Jeraidi Yassir
// Provided via justclaw.it.com; keep this notice with the code.
"use client";

import * as SwitchPrimitive from "@radix-ui/react-switch";
import type * as React from "react";

import { cn } from "@/lib/utils";

function Switch({
	className,
	icon,
	thumbClassName,
	...props
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
	icon?: React.ReactNode;
	thumbClassName?: string;
}) {
	return (
		<SwitchPrimitive.Root
			className={cn(
				"peer inline-flex h-7 w-12 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ri

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key