contiamo / operational-ui

Building blocks for effective operational interfaces
https://operational-ui.netlify.com
MIT License
258 stars 47 forks source link

Feature Request: Form schemas #1370

Open justinmchase opened 3 years ago

justinmchase commented 3 years ago

It may be asking for a lot but it would be super sweet if the forms could be auto-generated based on a Json Schema object being passed in.

Something like:

import * as React from "react"
import { Form, Input, Button } from "@operational/components"
const schema = {
  type: "object",
  properties: {
    firstName: { type: "string" },
    lastName: { type: "string" }
  }
}
const data = {
  firstName = 'Justin',
  lastName = 'Chase'
}
;<Form schema={schema} data={data}>
</Form>

And that would render a form with the appropriate fields.

There is a project already that does this react-jsonschema-form, perhaps its just a matter of bundling it and adding a custom theme?