switch.tsx — ui Source File
Architecture documentation for switch.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1955da35_530d_c73f_5930_901d9ff963e7["switch.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 1955da35_530d_c73f_5930_901d9ff963e7 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 9c463da6_747b_38dc_586b_cbb4873070b1["radix-ui"] 1955da35_530d_c73f_5930_901d9ff963e7 --> 9c463da6_747b_38dc_586b_cbb4873070b1 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 1955da35_530d_c73f_5930_901d9ff963e7 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 style 1955da35_530d_c73f_5930_901d9ff963e7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import { Switch as SwitchPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function Switch({
className,
size = "default",
...props
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
size?: "sm" | "default"
}) {
return (
<SwitchPrimitive.Root
data-slot="switch"
data-size={size}
className={cn(
"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 group/switch inline-flex 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 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",
className
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
)}
/>
</SwitchPrimitive.Root>
)
}
export { Switch }
Domain
Subdomains
Functions
Dependencies
- radix-ui
- react
- utils
Source
Frequently Asked Questions
What does switch.tsx do?
switch.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in switch.tsx?
switch.tsx defines 1 function(s): Switch.
What does switch.tsx depend on?
switch.tsx imports 3 module(s): radix-ui, react, utils.
Where is switch.tsx in the architecture?
switch.tsx is located at apps/v4/registry/new-york-v4/ui/switch.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/new-york-v4/ui).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free