@rjsf/material-ui
Version:
Material UI 4 theme, fields and widgets for react-jsonschema-form
20 lines • 887 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import ListItem from '@material-ui/core/ListItem';
import FormHelperText from '@material-ui/core/FormHelperText';
import List from '@material-ui/core/List';
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, { dense: true, disablePadding: true, children: errors.map((error, i) => {
return (_jsx(ListItem, { disableGutters: true, children: _jsx(FormHelperText, { id: id, children: error }) }, i));
}) }));
}
//# sourceMappingURL=FieldErrorTemplate.js.map