button.tsx — ui Source File
Architecture documentation for button.tsx, a tsx file in the ui codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR aee1c23d_a3f5_974a_d73d_ad9b953709ce["button.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] aee1c23d_a3f5_974a_d73d_ad9b953709ce --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 45bdba50_501d_4bbb_e6ef_5f033d29cffe["react-slot"] aee1c23d_a3f5_974a_d73d_ad9b953709ce --> 45bdba50_501d_4bbb_e6ef_5f033d29cffe 25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"] aee1c23d_a3f5_974a_d73d_ad9b953709ce --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] aee1c23d_a3f5_974a_d73d_ad9b953709ce --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 style aee1c23d_a3f5_974a_d73d_ad9b953709ce 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 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline:
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9",
},
},
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 }
Domain
Subdomains
Functions
Types
Dependencies
- class-variance-authority
- react
- react-slot
- utils
Source
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/new-york/ui/button.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