Home / Function/ Button() — ui Function Reference

Button() — ui Function Reference

Architecture documentation for the Button() function in button.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  20989170_19d3_9450_4d9f_e85e6d7b3079["Button()"]
  c56fb5b3_3073_011c_d274_6d9f2c2e51cc["button.tsx"]
  20989170_19d3_9450_4d9f_e85e6d7b3079 -->|defined in| c56fb5b3_3073_011c_d274_6d9f2c2e51cc
  style 20989170_19d3_9450_4d9f_e85e6d7b3079 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/radix/ui/button.tsx lines 37–58

function Button({
  className,
  variant = "default",
  size = "default",
  asChild = false,
  ...props
}: React.ComponentProps<"button"> &
  VariantProps<typeof buttonVariants> & {
    asChild?: boolean
  }) {
  const Comp = asChild ? Slot.Root : "button"

  return (
    <Comp
      data-slot="button"
      data-variant={variant}
      data-size={size}
      className={cn(buttonVariants({ variant, size, className }))}
      {...props}
    />
  )
}

Subdomains

Frequently Asked Questions

What does Button() do?
Button() is a function in the ui codebase, defined in apps/v4/registry/bases/radix/ui/button.tsx.
Where is Button() defined?
Button() is defined in apps/v4/registry/bases/radix/ui/button.tsx at line 37.

Analyze Your Own Codebase

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

Try Supermodel Free