Skip to content

cdllc/blueprintjs-form

 
 

Repository files navigation

@gravel-form/blueprintjs

A flexible middlewares driven json schema form. The only limitation is your imagination.

Quick start

npm install @gravel-form/blueprintjs
npm install @blueprintjs/datetime # optional
import React from 'React';
import '@blueprintjs/core/lib/css/blueprint.css';
import '@blueprintjs/datetime/lib/css/blueprint-datetime.css';
import { Form, presetMws } from "@gravel-form/blueprintjs";

const MyFirstForm = () => {
  const schema = {
    type: 'object',
    properties: {
      username: { type: 'string' },
      password: { type: 'string' },
    },
  };

  const extraProps = {
    properties: {
      password: {
        props: { type:'password' },
      },
    },
  };

  const [data, setData] = React.useState();

  return (
    <Form
      middlewares={presetMws}
      schema={schema}
      extraProps={extraProps}
      data={data}
      onChange={setData}
      onSubmit={(data) => {
        alert(JSON.stringify(data, null, 2));
      }}
    />
  );
};

Playground

More examples can be found on the playground.

About

A flexible middlewares driven json schema form with Blueprintjs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.1%
  • JavaScript 3.9%