Home / File/ toggle.tsx — ui Source File

toggle.tsx — ui Source File

Architecture documentation for toggle.tsx, a tsx file in the ui codebase. 4 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  952e8f2e_f34f_2beb_88ae_7f67b84a0f43["toggle.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  952e8f2e_f34f_2beb_88ae_7f67b84a0f43 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  952e8f2e_f34f_2beb_88ae_7f67b84a0f43 --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  9c463da6_747b_38dc_586b_cbb4873070b1["radix-ui"]
  952e8f2e_f34f_2beb_88ae_7f67b84a0f43 --> 9c463da6_747b_38dc_586b_cbb4873070b1
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  952e8f2e_f34f_2beb_88ae_7f67b84a0f43 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  style 952e8f2e_f34f_2beb_88ae_7f67b84a0f43 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Toggle as TogglePrimitive } from "radix-ui"

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

const toggleVariants = cva(
  "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
  {
    variants: {
      variant: {
        default: "bg-transparent",
        outline:
          "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
      },
      size: {
        default: "h-9 px-2 min-w-9",
        sm: "h-8 px-1.5 min-w-8",
        lg: "h-10 px-2.5 min-w-10",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  }
)

function Toggle({
  className,
  variant,
  size,
  ...props
}: React.ComponentProps<typeof TogglePrimitive.Root> &
  VariantProps<typeof toggleVariants>) {
  return (
    <TogglePrimitive.Root
      data-slot="toggle"
      className={cn(toggleVariants({ variant, size, className }))}
      {...props}
    />
  )
}

export { Toggle, toggleVariants }

Subdomains

Functions

Dependencies

  • class-variance-authority
  • radix-ui
  • react
  • utils

Frequently Asked Questions

What does toggle.tsx do?
toggle.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 toggle.tsx?
toggle.tsx defines 1 function(s): Toggle.
What does toggle.tsx depend on?
toggle.tsx imports 4 module(s): class-variance-authority, radix-ui, react, utils.
Where is toggle.tsx in the architecture?
toggle.tsx is located at apps/v4/registry/new-york-v4/ui/toggle.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