import * as RadioGroup from "@radix-ui/react-radio-group" import { useField } from "formik" import React from "react" import ErrorMessage from "./ErrorMessage" import RequiredAsterisk from "./RequiredAsterisk" import Separator from "./Separator" const RadioGroupField = ({ name, label, separator, options, ...props }: { name: string label: string separator?: boolean options: string[] [x: string]: any // Allow any other props }) => { const { required, ...restProps } = props const [field, meta, helpers] = useField({ ...restProps, name }) const handleChange = (value: string) => { helpers.setValue(value) } return (
{separator && }
{options.map((option) => (
))}
) } export default RadioGroupField