import React from "react"; import { CheckboxProps, Checkbox } from "@mantine/core"; import CheckboxGroup from "./RHFCheckboxGroup"; import { useController, FieldValues, UseControllerProps, } from "react-hook-form"; type Props = CheckboxProps & { name: UseControllerProps["name"]; rules?: UseControllerProps["rules"]; defaultValue?: UseControllerProps["defaultValue"]; }; function RHFCheckbox(props: Props) { const { name, rules, defaultValue, ...others } = props; const { field, fieldState: { error }, } = useController({ name, rules }); return ( ); } RHFCheckbox.Group = CheckboxGroup; export default RHFCheckbox; export const createCheckboxField = () => { const Field = (props: Props) => ; return Field; };