import { FormControl, FormControlProps } from '@chakra-ui/form-control' import { Stack, StackDirection, Text } from '@chakra-ui/layout' import { Radio, RadioGroup } from '@chakra-ui/radio' import * as React from 'react' interface ICustomRadioProps { data?: any direction?: StackDirection | undefined register?: any name: string errors?: any label?: string } const CustomRadio: React.FunctionComponent = (props) => { const { label, errors, name, data = [], direction = 'row', register, ...rest } = props const error = errors[name] return ( {label && data.length > 0 && ( {label} )} {data.map((item, key) => ( {item.name} ))} {error && data.length > 0 && ( {error?.message} )} ) } export default CustomRadio