@gravel-form/chakra-ui
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@gravel-form/chakra-ui

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

Quick start

npm install @chakra-ui/core @emotion/core @emotion/styled emotion-theming
npm install @gravel-form/chakra-ui
import React from 'react';
import { theme, ThemeProvider, CSSReset } from '@chakra-ui/core';
import { Form } from '@gravel-form/chakra-ui/lib';

function 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
      schema={schema}
      extraProps={extraProps}
      data={data}
      onChange={setData}
      size="md"
      onSubmit={(data) => {
        alert(JSON.stringify(data, null, 2));
      }}
    />
  );
}

function App() {
  return (
    <ThemeProvider theme={theme}>
      <CSSReset />
      <MyFirstForm />
    </ThemeProvider>
  );
}

export default App;

Playground

More examples can be found on the playground.

Package Sidebar

Install

npm i @gravel-form/chakra-ui

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

132 kB

Total Files

87

Last publish

Collaborators

  • knilink