// form import { useFormContext, Controller } from 'react-hook-form'; // @mui import { Radio, RadioGroup, FormHelperText, RadioGroupProps, FormControlLabel, } from '@mui/material'; // ---------------------------------------------------------------------- interface IProps { name: string; options: string[]; getOptionLabel?: string[]; fullWidth?: boolean; disabled?: boolean; } export default function RHFRadioGroup({ name, options, getOptionLabel, fullWidth, disabled, ...other }: IProps & RadioGroupProps) { const { control } = useFormContext(); return ( (
{options.map((option, index) => ( } label={getOptionLabel?.length ? getOptionLabel[index] : option} disabled={disabled} /> ))} {!!error && ( {error.message} )}
)} /> ); }