import React from "react"; import { SegmentedControl, SegmentedControlProps, TextInput, TextInputProps, } from "@mantine/core"; import { useController, FieldValues, UseControllerProps, } from "react-hook-form"; type Props = SegmentedControlProps & { name: UseControllerProps["name"]; rules?: UseControllerProps["rules"]; defaultValue?: UseControllerProps["defaultValue"]; }; function RHFSegmentedControl( props: Props ) { const { name, rules, defaultValue, ...others } = props; const { field, fieldState: { error }, } = useController({ name, rules }); return ; } export default RHFSegmentedControl; export const createSegmentedControlField = () => { const Field = (props: Props) => ; return Field; };