// shadcn ToggleGroup — Radix wrapper. Group of s sharing a // single (`type="single"`) or multiple-selection (`type="multiple"`) // state. Used in ProfileMenu for the inline theme + language chip // rows; usable anywhere a small chip-radio is the right primitive. // // Variants + size flow down via React Context so individual items // don't need to re-declare them — mirrors shadcn's reference. import { createContext, forwardRef, useContext, type ComponentPropsWithoutRef, type ComponentRef, } from 'react' import * as RTG from '@radix-ui/react-toggle-group' import { type VariantProps } from 'class-variance-authority' import { cn } from '../cn' import { toggleVariants } from './toggle' type ToggleGroupVariants = VariantProps const ToggleGroupContext = createContext({ variant: 'default', size: 'default', }) export const ToggleGroup = forwardRef< ComponentRef, ComponentPropsWithoutRef & ToggleGroupVariants >(({ className, variant, size, children, ...props }, ref) => ( {children} )) ToggleGroup.displayName = 'ToggleGroup' export const ToggleGroupItem = forwardRef< ComponentRef, ComponentPropsWithoutRef & ToggleGroupVariants >(({ className, variant, size, children, ...props }, ref) => { const ctx = useContext(ToggleGroupContext) return ( {children} ) }) ToggleGroupItem.displayName = 'ToggleGroupItem'