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
  a2932704_3aec_ea18_04b4_6431a4eb8ffb["toggle.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  a2932704_3aec_ea18_04b4_6431a4eb8ffb --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  d69acd56_311f_b931_a3ba_890ea9bd7d7f["react-toggle"]
  a2932704_3aec_ea18_04b4_6431a4eb8ffb --> d69acd56_311f_b931_a3ba_890ea9bd7d7f
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  a2932704_3aec_ea18_04b4_6431a4eb8ffb --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  a2932704_3aec_ea18_04b4_6431a4eb8ffb --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  style a2932704_3aec_ea18_04b4_6431a4eb8ffb 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 gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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",
  {
    variants: {
      variant: {
        default: "bg-transparent",
        outline:
          "border border-input bg-transparent shadow-sm 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",
    },
  }
)

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/new-york/ui/toggle.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/new-york/ui).

Analyze Your Own Codebase

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

Try Supermodel Free