npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

material-ui-form-builder

v1.0.30

Published

This project is used by Lessence.One for build easily [Material-UI][mui] forms with every built-in or 3rd party material ui component like [material-ui-chip-input][muichip]. We continuously increase the number of components when we need it or by pull requ

Downloads

322

Readme

material-ui-form-builder

This project is used by Lessence.One for build easily Material-UI forms with every built-in or 3rd party material ui component like material-ui-chip-input. We continuously increase the number of components when we need it or by pull requests.

Disclaimer

This is just a quick tentative try to create a component where we have form state management, form builder and material ui. Later we would like to replace the quick solutions with existing ones to provide as many feature as we can.

Installation

npm i --save material-ui-form-builder

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';

import Form from 'material-ui-form-builder';

const fields = [{ name: 'name', type: 'text' }, { name: 'limit', type: 'number' }];
const theme = createMuiTheme({
  palette: {
    primary: { main: '#8BC3D1' },
  },
});

ReactDOM.render(
  <div>
    <MuiThemeProvider theme={theme}>
      <Form
        fieldContainerStyle={{ backgroundColor: '#fefefe', padding: 10 }}
        onChange={(values) => console.log(values)}
        fields={fields}
        values={{ name: 'test', limit: 10 }}
        errors={{ limit: 'This field is required.' }}
      />
    </MuiThemeProvider>
  </div>,
  document.getElementById('root')
);

Form fields

text

Example: {name: 'name', type: 'text'}

| Property | Type | Default | Description | | -------- | -------- | ------- | ----------------------------------- | | default | string | | The default value for the field | | disabled | bool | | Set true to disable the field | | key | string | key | The identifier in the values object | | name | string | field | The label of the field |

multiLineText

Example: {name: 'name', type: 'multiLineText', rows: 5}

| Property | Type | Default | Description | | -------- | -------- | ------- | ----------------------------------------- | | default | number | | The default value for the field | | disabled | bool | | Set true to disable the field | | key | string | key | The identifier in the values object | | name | string | field | The label of the field | | rows | number | 1 | Number of rows to display | | rowsMax | number | 2 | Maximum number of rows to display | | emoji | bool | false | Set true to make visible the emoji-picker |

number

Example: {name: 'name', type: 'number'}

| Property | Type | Default | Description | | -------- | -------- | ------- | ----------------------------------- | | default | string | | The default value for the field | | disabled | bool | | Set true to disable the field | | key | string | key | The identifier in the values object | | name | string | field | The label of the field |

select

Example: {name: 'name', type: 'select', items: [{value: 1, title: 'item'}]}

| Property | Type | Default | Description | | ----------- | -------- | ------- | -------------------------------------------------------------------------------- | | default | mixed | | The default value for the field | | disabled | bool | | Set true to disable the field | | items | array | | The list for select items. | | key | string | key | The identifier in the values object | | multiple | bool | false | Will support multiple selections, if value is trues | | name | string | field | The label of the field | | dialogActive | bool | false | If it is true, alert dialog will pop up every time when the value is changing | | dialogContent| string | | The content of the alert dialog | | dialogTitle | string | | The title of the alert dialog |

checkbox

Example: {name: 'name', type: 'checkbox'}

| Property | Type | Default | Description | | -------- | -------- | ------- | ----------------------------------- | | default | mixed | | The default value for the field | | disabled | bool | | Set true to disable the field | | key | string | key | The identifier in the values object | | name | string | field | The label of the field |

chip

Example: {name: 'name', type: 'chip', items: [{value: 1, title: 'item'}]}

| Property | Type | Default | Description | | -------- | -------- | ------- | ----------------------------------- | | default | mixed | | The default value for the field | | key | string | key | The identifier in the values object | | name | string | field | The label of the field |

Properties

| Name | Type | Default | Description | | --------------- | ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | delayTime | number | | In case when you would like to fire a delayed event about value changes. | | delayTriggers | array | | The field elements that fire the onDelayedChange callback when these fields are changed, delayed by the delayTime prop. Every other field has 0 delay time. | | errors | object | | The object to show errors by field. Example: {name: 'This field is required.'} | | focusStyle | object | | The style object to use to override floating label styles when focused. | | handleChange | function | | Callback function that is fired when one of the field's value changes. Signature: function(field: string, value: mixed) => void | | onChange | function | | Callback function that is fired when the form values changes. Signature: function(values: object) => void | | onDelayedChange | function | | Callback function that is fired delayed when the form values changes. Signature: function(values: object) => void | | saveForm | function | | If this property passed to the component then a save button is displayed. Callback function that is fired when click to save button. Signature: function(values: object) => void | | values | object | | The values for the form fields |

Please open an issue if something is missing or does not work as expected.