import RadioButton from "../RadioButton";
import type { RadioGroupViewProps } from "./RadioGroup.types";
export function RadioGroupView({
groupId,
value,
mode,
state,
disabled,
options,
className,
ariaLabel,
onOptionChange,
}: RadioGroupViewProps) {
return (
{options.map((option) => {
const isSelected = value === option.value;
// If there's subtext, render radio button without label and handle layout separately
if (option.subtext) {
return (
{
if (checked) {
onOptionChange(option.value);
}
}}
/>
{option.label}
{option.subtext}
);
}
// If no subtext, use RadioButton's built-in label
return (
{
if (checked) {
onOptionChange(option.value);
}
}}
/>
);
})}
);
}