import { useFormContext, Controller } from 'react-hook-form'; // @mui import FormHelperText from '@mui/material/FormHelperText'; import Slider, { SliderProps } from '@mui/material/Slider'; // ---------------------------------------------------------------------- type Props = SliderProps & { name: string; helperText?: React.ReactNode; }; export default function RHFSlider({ name, helperText, ...other }: Props) { const { control } = useFormContext(); return ( ( <> {(!!error || helperText) && ( {error ? error?.message : helperText} )} )} /> ); }