import * as React from "react"; import { RadioGroup as BaseRadioGroup, RadioGroupItem, } from "@/components/ui/radio-group"; import { Label } from "@/components/ui/label"; import { cn } from "@/lib/utils"; interface RadioContextValue { name: string; } const RadioContext = React.createContext({ name: "radio-group", }); export interface RadioGroupProps { children: React.ReactNode; label?: React.ReactNode; onValueChange?: (value: string) => void; orientation?: "horizontal" | "vertical"; value?: string; } export function RadioGroup({ children, label, onValueChange, orientation = "vertical", value, }: RadioGroupProps) { const generatedName = React.useId(); return (
{label ?

{label}

: null} {children}
); } export interface RadioProps { children?: React.ReactNode; value: string; } export function Radio({ children, value }: RadioProps) { const context = React.useContext(RadioContext); const id = `${context.name}-${value}`; return (
); }