| 1 |
import FormHelperText from '@mui/material/FormHelperText'; |
| 2 |
import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; |
| 3 |
|
| 4 |
/** The `FieldHelpTemplate` component renders any help desired for a field |
| 5 |
* |
| 6 |
* @param props - The `FieldHelpProps` to be rendered |
| 7 |
*/ |
| 8 |
export default function FieldHelpTemplate< |
| 9 |
T = any, |
| 10 |
S extends StrictRJSFSchema = RJSFSchema, |
| 11 |
F extends FormContextType = any |
| 12 |
>(props: FieldHelpProps<T, S, F>) { |
| 13 |
const { idSchema, help } = props; |
| 14 |
if (!help) { |
| 15 |
return null; |
| 16 |
} |
| 17 |
const id = helpId<T>(idSchema); |
| 18 |
return <FormHelperText id={id}>{help}</FormHelperText>; |
| 19 |
} |