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

Relationship Graph

Source Code

apps/v4/registry/bases/base/ui/toggle-group.tsx lines 23–57

function ToggleGroup({
  className,
  variant,
  size,
  spacing = 0,
  orientation = "horizontal",
  children,
  ...props
}: ToggleGroupPrimitive.Props &
  VariantProps<typeof toggleVariants> & {
    spacing?: number
    orientation?: "horizontal" | "vertical"
  }) {
  return (
    <ToggleGroupPrimitive
      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>
  )
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free