UNPKG

@rjsf/mui

Version:

Material UI 5 theme, fields and widgets for react-jsonschema-form

20 lines 938 B
import { jsx as _jsx } from "react/jsx-runtime"; import ListItem from '@mui/material/ListItem/index.js'; import FormHelperText from '@mui/material/FormHelperText/index.js'; import List from '@mui/material/List/index.js'; import { errorId } from '@rjsf/utils'; /** The `FieldErrorTemplate` component renders the errors local to the particular field * * @param props - The `FieldErrorProps` for the errors being rendered */ export default function FieldErrorTemplate(props) { const { errors = [], idSchema } = props; if (errors.length === 0) { return null; } const id = errorId(idSchema); return (_jsx(List, { id: id, dense: true, disablePadding: true, children: errors.map((error, i) => { return (_jsx(ListItem, { disableGutters: true, children: _jsx(FormHelperText, { component: 'div', id: `${id}-${i}`, children: error }) }, i)); }) })); } //# sourceMappingURL=FieldErrorTemplate.js.map