@datalayer/primer-rjsf
Version:
React JSON Schema Form (RJSF) for Primer
50 lines (49 loc) • 1.67 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from "react";
function ObjectFieldTemplate({ TitleField, properties, title, description }) {
return (_jsxs("div", { children: [_jsx(TitleField, { title: title }), _jsx("div", { className: "row", children: properties.map((prop) => (_jsx("div", { className: "col-lg-2 col-md-4 col-sm-6 col-xs-12", children: prop.content }, prop.content.key))) }), description] }));
}
export default {
schema: {
title: "A registration form",
description: "This is the same as the simple form, but it is rendered as a bootstrap grid. Try shrinking the browser window to see it in action.",
type: "object",
required: ["firstName", "lastName"],
properties: {
firstName: {
type: "string",
title: "First name",
},
lastName: {
type: "string",
title: "Last name",
},
age: {
type: "integer",
title: "Age",
},
bio: {
type: "string",
title: "Bio",
},
password: {
type: "string",
title: "Password",
minLength: 3,
},
telephone: {
type: "string",
title: "Telephone",
minLength: 10,
},
},
},
formData: {
firstName: "Chuck",
lastName: "Norris",
age: 75,
bio: "Roundhouse kicking asses since 1940",
password: "noneed",
},
ObjectFieldTemplate,
};