button-group.tsx — ui Source File
Architecture documentation for button-group.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5d01add1_f2e7_2b11_8934_82561fc61c78["button-group.tsx"] 9c25e96d_58e7_da5f_38f2_06bde0124112["merge-props"] 5d01add1_f2e7_2b11_8934_82561fc61c78 --> 9c25e96d_58e7_da5f_38f2_06bde0124112 54befa66_d51c_07e2_ec3f_848afbcd88a7["use-render"] 5d01add1_f2e7_2b11_8934_82561fc61c78 --> 54befa66_d51c_07e2_ec3f_848afbcd88a7 25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"] 5d01add1_f2e7_2b11_8934_82561fc61c78 --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df 8ad666ec_1b20_adda_0392_87a60bdb3a68["utils"] 5d01add1_f2e7_2b11_8934_82561fc61c78 --> 8ad666ec_1b20_adda_0392_87a60bdb3a68 a3c00059_fa03_cf5e_4e2a_284c527e1995["separator"] 5d01add1_f2e7_2b11_8934_82561fc61c78 --> a3c00059_fa03_cf5e_4e2a_284c527e1995 style 5d01add1_f2e7_2b11_8934_82561fc61c78 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/registry/bases/base/lib/utils"
import { Separator } from "@/registry/bases/base/ui/separator"
const buttonGroupVariants = cva(
"cn-button-group flex w-fit items-stretch *:focus-visible:z-10 *:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
{
variants: {
orientation: {
horizontal:
"cn-button-group-orientation-horizontal [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0 *:data-slot:rounded-r-none",
vertical:
"cn-button-group-orientation-vertical flex-col [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0 *:data-slot:rounded-b-none",
},
},
defaultVariants: {
orientation: "horizontal",
},
}
)
function ButtonGroup({
className,
orientation,
...props
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
return (
<div
role="group"
data-slot="button-group"
data-orientation={orientation}
className={cn(buttonGroupVariants({ orientation }), className)}
{...props}
/>
)
}
function ButtonGroupText({
className,
render,
...props
}: useRender.ComponentProps<"div">) {
return useRender({
defaultTagName: "div",
props: mergeProps<"div">(
{
className: cn(
"cn-button-group-text flex items-center [&_svg]:pointer-events-none",
className
),
},
props
),
render,
state: {
slot: "button-group-text",
},
})
}
function ButtonGroupSeparator({
className,
orientation = "vertical",
...props
}: React.ComponentProps<typeof Separator>) {
return (
<Separator
data-slot="button-group-separator"
orientation={orientation}
className={cn(
"cn-button-group-separator relative self-stretch data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
className
)}
{...props}
/>
)
}
export {
ButtonGroup,
ButtonGroupSeparator,
ButtonGroupText,
buttonGroupVariants,
}
Domain
Subdomains
Dependencies
- class-variance-authority
- merge-props
- separator
- use-render
- utils
Source
Frequently Asked Questions
What does button-group.tsx do?
button-group.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, UIPrimitives subdomain.
What functions are defined in button-group.tsx?
button-group.tsx defines 3 function(s): ButtonGroup, ButtonGroupSeparator, ButtonGroupText.
What does button-group.tsx depend on?
button-group.tsx imports 5 module(s): class-variance-authority, merge-props, separator, use-render, utils.
Where is button-group.tsx in the architecture?
button-group.tsx is located at apps/v4/registry/bases/base/ui/button-group.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: apps/v4/registry/bases/base/ui).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free