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

Relationship Graph

Source Code

apps/v4/examples/base/ui/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/toggle-group.tsx.
Where is ToggleGroup() defined?
ToggleGroup() is defined in apps/v4/examples/base/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