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

Relationship Graph

Source Code

apps/v4/examples/base/ui-rtl/toggle-group.tsx lines 22–56

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(
        "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>
  )
}

Subdomains

Frequently Asked Questions

What does ToggleGroup() do?
ToggleGroup() is a function in the ui codebase, defined in apps/v4/examples/base/ui-rtl/toggle-group.tsx.
Where is ToggleGroup() defined?
ToggleGroup() is defined in apps/v4/examples/base/ui-rtl/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