Home / Function/ Switch() — ui Function Reference

Switch() — ui Function Reference

Architecture documentation for the Switch() function in switch.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  000a1444_0575_5933_2d5b_ba24ecb7563f["Switch()"]
  7458acf2_2798_88f6_90dc_2f4c4a3ef9e7["switch.tsx"]
  000a1444_0575_5933_2d5b_ba24ecb7563f -->|defined in| 7458acf2_2798_88f6_90dc_2f4c4a3ef9e7
  style 000a1444_0575_5933_2d5b_ba24ecb7563f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/base/ui/switch.tsx lines 7–30

function Switch({
  className,
  size = "default",
  ...props
}: SwitchPrimitive.Root.Props & {
  size?: "sm" | "default"
}) {
  return (
    <SwitchPrimitive.Root
      data-slot="switch"
      data-size={size}
      className={cn(
        "cn-switch peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",
        className
      )}
      {...props}
    >
      <SwitchPrimitive.Thumb
        data-slot="switch-thumb"
        className="cn-switch-thumb pointer-events-none block ring-0 transition-transform"
      />
    </SwitchPrimitive.Root>
  )
}

Subdomains

Frequently Asked Questions

What does Switch() do?
Switch() is a function in the ui codebase, defined in apps/v4/registry/bases/base/ui/switch.tsx.
Where is Switch() defined?
Switch() is defined in apps/v4/registry/bases/base/ui/switch.tsx at line 7.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free