'use client' import type { ReactNode } from 'react' import type { QuestionOption } from '@/lib/types' interface RadioGroupProps { name: string legend: ReactNode options: QuestionOption[] value: string | undefined required: boolean onChange: (value: string) => void error?: string } export function RadioGroup({ name, legend, options, value, required, onChange, error, }: RadioGroupProps) { return (
{legend} {required && } {required && (obligatorio)}
{options.map((opt) => { const id = `${name}_${opt.value.replace(/\s+/g, '_')}` return (
) })}
{error && ( )}
) }