Debian Codegraph @

packages/mui/src/DescriptionField/DescriptionField.tsx

raw
1 import Typography from '@mui/material/Typography';
2 import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
4 /** The `DescriptionField` is the template to use to render the description of a field
5 *
6 * @param props - The `DescriptionFieldProps` for this component
7 */
8 export default function DescriptionField<
9 T = any,
10 S extends StrictRJSFSchema = RJSFSchema,
11 F extends FormContextType = any
12 >(props: DescriptionFieldProps<T, S, F>) {
13 const { id, description } = props;
14 if (description) {
15 return (
16 <Typography id={id} variant='subtitle2' style={{ marginTop: '5px' }}>
17 {description}
18 </Typography>
19 );
20 }
21
22 return null;
23 }