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 dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d["button-group.tsx"] 3d9438e8_7604_787c_4898_907262aff28b["utils"] dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d --> 3d9438e8_7604_787c_4898_907262aff28b d91f2d92_028d_f8a9_3acf_7be6f2a34921["separator"] dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d --> d91f2d92_028d_f8a9_3acf_7be6f2a34921 9c25e96d_58e7_da5f_38f2_06bde0124112["merge-props"] dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d --> 9c25e96d_58e7_da5f_38f2_06bde0124112 54befa66_d51c_07e2_ec3f_848afbcd88a7["use-render"] dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d --> 54befa66_d51c_07e2_ec3f_848afbcd88a7 25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"] dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df style dffc2ca6_cdfb_6b1b_4c9b_8b36fb5a335d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { cn } from "@/examples/base/lib/utils"
import { Separator } from "@/examples/base/ui-rtl/separator"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
const buttonGroupVariants = cva(
"has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-e-lg 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:
"[&>[data-slot]:not(:has(~[data-slot]))]:rounded-e-lg! [&>[data-slot]~[data-slot]]:rounded-s-none [&>[data-slot]~[data-slot]]:border-s-0 *:data-slot:rounded-e-none",
vertical:
"[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! 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(
"bg-muted gap-2 rounded-lg border px-2.5 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 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(
"bg-input 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 DocumentationAtlas domain, ContentSourcing 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/examples/base/ui-rtl/button-group.tsx (domain: DocumentationAtlas, subdomain: ContentSourcing, directory: apps/v4/examples/base/ui-rtl).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free