1.0.0 • Published 4 years ago

schemak v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

schematiq

Generate Formik forms from schemas

NPM JavaScript Style Guide

Install

npm install --save schematiq

Future plans

  • Styling
  • Repeater fields

Usage

import * as React from "react";
import Schematiq from "schematiq";

class Example extends React.Component {
  render() {
    return (
      <Schematiq
        fields={[
          {
            name: "name",
            label: "Full Name"
          },
          {
            name: "picture",
            label: "Profile Picture",
            type: "file"
          },
          {
            name: "select",
            label: "Select",
            type: "select",
            component: "select",
            options: [1, { label: "two", value: 2 }, 3, 4, 5, 6]
          },
          {
            name: "checkbox",
            label: "Checkbox",
            type: "checkbox"
          },
          {
            name: "about",
            label: "About",
            component: "textarea"
          },
          {
            name: "openingTimes",
            label: "Opening Times",
            object: [
              {
                name: "day",
                label: "Day",
                type: "select",
                component: "select",
                options: [
                  "Monday",
                  "Tuesday",
                  "Wednesday",
                  "Thursday",
                  "Friday"
                ]
              },
              {
                name: "time",
                label: "Time range"
              }
            ],
            buttonLabel: "Add opening time"
          }
        ]}
        initialValues={{}}
      />
    );
  }
}

License

MIT © ovidiu-balau