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
  bcdc6718_876a_9e4c_6fba_c320f04e1524["ToggleGroup()"]
  144ec659_fe66_180d_5a2b_6b4728d590b3["toggle-group.tsx"]
  bcdc6718_876a_9e4c_6fba_c320f04e1524 -->|defined in| 144ec659_fe66_180d_5a2b_6b4728d590b3
  style bcdc6718_876a_9e4c_6fba_c320f04e1524 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/examples/radix/ui/toggle-group.tsx lines 21–55

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(
        "group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-vertical:flex-col data-vertical:items-stretch data-[size=sm]:rounded-[min(var(--radius-md),10px)]",
        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/examples/radix/ui/toggle-group.tsx.
Where is ToggleGroup() defined?
ToggleGroup() is defined in apps/v4/examples/radix/ui/toggle-group.tsx at line 21.

Analyze Your Own Codebase

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

Try Supermodel Free