toggle-group.tsx — ui Source File
Architecture documentation for toggle-group.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 63ab1eeb_5132_696d_5fbf_721bd3694f22["toggle-group.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 63ab1eeb_5132_696d_5fbf_721bd3694f22 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 4fcad219_2f22_9e3c_d0d7_3b6dbb82c1fa["react-toggle-group"] 63ab1eeb_5132_696d_5fbf_721bd3694f22 --> 4fcad219_2f22_9e3c_d0d7_3b6dbb82c1fa 25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"] 63ab1eeb_5132_696d_5fbf_721bd3694f22 --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 63ab1eeb_5132_696d_5fbf_721bd3694f22 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 e32518d5_161b_68da_2fcc_37a318659d51["toggle"] 63ab1eeb_5132_696d_5fbf_721bd3694f22 --> e32518d5_161b_68da_2fcc_37a318659d51 style 63ab1eeb_5132_696d_5fbf_721bd3694f22 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
import { type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { toggleVariants } from "@/registry/default/ui/toggle"
const ToggleGroupContext = React.createContext<
VariantProps<typeof toggleVariants>
>({
size: "default",
variant: "default",
})
const ToggleGroup = React.forwardRef<
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
VariantProps<typeof toggleVariants>
>(({ className, variant, size, children, ...props }, ref) => (
<ToggleGroupPrimitive.Root
ref={ref}
className={cn("flex items-center justify-center gap-1", className)}
{...props}
>
<ToggleGroupContext.Provider value={{ variant, size }}>
{children}
</ToggleGroupContext.Provider>
</ToggleGroupPrimitive.Root>
))
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
const ToggleGroupItem = React.forwardRef<
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
VariantProps<typeof toggleVariants>
>(({ className, children, variant, size, ...props }, ref) => {
const context = React.useContext(ToggleGroupContext)
return (
<ToggleGroupPrimitive.Item
ref={ref}
className={cn(
toggleVariants({
variant: context.variant || variant,
size: context.size || size,
}),
className
)}
{...props}
>
{children}
</ToggleGroupPrimitive.Item>
)
})
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
export { ToggleGroup, ToggleGroupItem }
Domain
Subdomains
Functions
Dependencies
- class-variance-authority
- react
- react-toggle-group
- toggle
- utils
Source
Frequently Asked Questions
What does toggle-group.tsx do?
toggle-group.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 toggle-group.tsx?
toggle-group.tsx defines 2 function(s): ToggleGroup, ToggleGroupItem.
What does toggle-group.tsx depend on?
toggle-group.tsx imports 5 module(s): class-variance-authority, react, react-toggle-group, toggle, utils.
Where is toggle-group.tsx in the architecture?
toggle-group.tsx is located at deprecated/www/registry/default/ui/toggle-group.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