Home / File/ button.tsx — ui Source File

button.tsx — ui Source File

Architecture documentation for button.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
  f8f0a13f_8dae_ad5f_74ef_a65cfcba7052["button.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  f8f0a13f_8dae_ad5f_74ef_a65cfcba7052 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  45bdba50_501d_4bbb_e6ef_5f033d29cffe["react-slot"]
  f8f0a13f_8dae_ad5f_74ef_a65cfcba7052 --> 45bdba50_501d_4bbb_e6ef_5f033d29cffe
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  f8f0a13f_8dae_ad5f_74ef_a65cfcba7052 --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  f8f0a13f_8dae_ad5f_74ef_a65cfcba7052 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  style f8f0a13f_8dae_ad5f_74ef_a65cfcba7052 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

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

const buttonVariants = cva(
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground hover:bg-primary/90",
        destructive:
          "bg-destructive text-destructive-foreground hover:bg-destructive/90",
        outline:
          "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
        secondary:
          "bg-secondary text-secondary-foreground hover:bg-secondary/80",
        ghost: "hover:bg-accent hover:text-accent-foreground",
        link: "text-primary underline-offset-4 hover:underline",
      },
      size: {
        default: "h-10 px-4 py-2",
        sm: "h-9 rounded-md px-3",
        lg: "h-11 rounded-md px-8",
        icon: "h-10 w-10",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  }
)

export interface ButtonProps
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
    VariantProps<typeof buttonVariants> {
  asChild?: boolean
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
  ({ className, variant, size, asChild = false, ...props }, ref) => {
    const Comp = asChild ? Slot : "button"
    return (
      <Comp
        className={cn(buttonVariants({ variant, size, className }))}
        ref={ref}
        {...props}
      />
    )
  }
)
Button.displayName = "Button"

export { Button, buttonVariants }

Subdomains

Functions

Types

Dependencies

  • class-variance-authority
  • react
  • react-slot
  • utils

Frequently Asked Questions

What does button.tsx do?
button.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 button.tsx?
button.tsx defines 1 function(s): Button.
What does button.tsx depend on?
button.tsx imports 4 module(s): class-variance-authority, react, react-slot, utils.
Where is button.tsx in the architecture?
button.tsx is located at deprecated/www/registry/default/ui/button.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