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
  c88739a6_14d2_f750_b94f_3b356042749e["toggle.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  c88739a6_14d2_f750_b94f_3b356042749e --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  d69acd56_311f_b931_a3ba_890ea9bd7d7f["react-toggle"]
  c88739a6_14d2_f750_b94f_3b356042749e --> d69acd56_311f_b931_a3ba_890ea9bd7d7f
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  c88739a6_14d2_f750_b94f_3b356042749e --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  c88739a6_14d2_f750_b94f_3b356042749e --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  style c88739a6_14d2_f750_b94f_3b356042749e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

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

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

const toggleVariants = cva(
  "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2",
  {
    variants: {
      variant: {
        default: "bg-transparent",
        outline:
          "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
      },
      size: {
        default: "h-10 px-3 min-w-10",
        sm: "h-9 px-2.5 min-w-9",
        lg: "h-11 px-5 min-w-11",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  }
)

const Toggle = React.forwardRef<
  React.ElementRef<typeof TogglePrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
    VariantProps<typeof toggleVariants>
>(({ className, variant, size, ...props }, ref) => (
  <TogglePrimitive.Root
    ref={ref}
    className={cn(toggleVariants({ variant, size, className }))}
    {...props}
  />
))

Toggle.displayName = TogglePrimitive.Root.displayName

export { Toggle, toggleVariants }

Subdomains

Functions

Dependencies

  • class-variance-authority
  • react
  • react-toggle
  • 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, react, react-toggle, utils.
Where is toggle.tsx in the architecture?
toggle.tsx is located at deprecated/www/registry/default/ui/toggle.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/default/ui).

Analyze Your Own Codebase

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

Try Supermodel Free