MCPcopy
hub / github.com/langbot-app/LangBot / Switch

Function Switch

web/src/components/ui/switch.tsx:6–27  ·  view source on GitHub ↗
({
  className,
  ...props
}: React.ComponentProps<typeof SwitchPrimitive.Root>)

Source from the content-addressed store, hash-verified

4import { cn } from '@/lib/utils';
5
6function Switch({
7 className,
8 ...props
9}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
10 return (
11 <SwitchPrimitive.Root
12 data-slot="switch"
13 className={cn(
14 'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
15 className,
16 )}
17 {...props}
18 >
19 <SwitchPrimitive.Thumb
20 data-slot="switch-thumb"
21 className={cn(
22 'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
23 )}
24 />
25 </SwitchPrimitive.Root>
26 );
27}
28
29export { Switch };

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected