@datalayer/primer-rjsf
Version:
React JSON Schema Form (RJSF) for Primer
16 lines (15 loc) • 709 B
JavaScript
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { Text } from "@primer/react";
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("div", { id: id, children: errors.map((error, i) => (_jsxs(Text, { as: "p", mb: 1, sx: { fontSize: '12px', display: 'block', color: 'danger.fg' }, children: ["\u2022", " " + error] }, i))) }));
}