Home / Function/ ToggleGroup() — ui Function Reference

ToggleGroup() — ui Function Reference

Architecture documentation for the ToggleGroup() function in toggle-group.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  87e0cc43_44a5_dbcb_8bcd_f6fe6ce0f887["ToggleGroup()"]
  9d43e8e3_203c_eb9e_7615_34045fe17729["toggle-group.tsx"]
  87e0cc43_44a5_dbcb_8bcd_f6fe6ce0f887 -->|defined in| 9d43e8e3_203c_eb9e_7615_34045fe17729
  style 87e0cc43_44a5_dbcb_8bcd_f6fe6ce0f887 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/radix/ui/toggle-group.tsx lines 22–56

function ToggleGroup({
  className,
  variant,
  size,
  spacing = 0,
  orientation = "horizontal",
  children,
  ...props
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
  VariantProps<typeof toggleVariants> & {
    spacing?: number
    orientation?: "horizontal" | "vertical"
  }) {
  return (
    <ToggleGroupPrimitive.Root
      data-slot="toggle-group"
      data-variant={variant}
      data-size={size}
      data-spacing={spacing}
      data-orientation={orientation}
      style={{ "--gap": spacing } as React.CSSProperties}
      className={cn(
        "cn-toggle-group group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-vertical:flex-col data-vertical:items-stretch",
        className
      )}
      {...props}
    >
      <ToggleGroupContext.Provider
        value={{ variant, size, spacing, orientation }}
      >
        {children}
      </ToggleGroupContext.Provider>
    </ToggleGroupPrimitive.Root>
  )
}

Subdomains

Frequently Asked Questions

What does ToggleGroup() do?
ToggleGroup() is a function in the ui codebase, defined in apps/v4/registry/bases/radix/ui/toggle-group.tsx.
Where is ToggleGroup() defined?
ToggleGroup() is defined in apps/v4/registry/bases/radix/ui/toggle-group.tsx at line 22.

Analyze Your Own Codebase

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

Try Supermodel Free