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-form-builder

v1.2.9

Published

FormBuilder For React.js

Downloads

529

Readme

Mui Version Compatibility

| MUI version | MFB version | | ---- | ---- | | ^5.x | ^0.x | | ^6.x | ^1.x |

Quick Access

introduction

Installation

Dependencies

Material UI (^5.x.x) is available as an npm package.

npm install @mui/material @mui/x-date-pickers @mui/icons-material @emotion/react @emotion/styled dayjs

material-form-builder

npm:

npm install material-form-builder

yarn:

yarn add material-form-builder

basic usage:

import React, { useRef } from 'react'
import { FormBuilder } from 'material-form-builder'

const App = () => {
    const builderRef = useRef(null)
    const getValues = () => {
        const values = builderRef.current?.getValues()
    }
    const clear = () => {
        builderRef.current?.clear()
    }
    return (
        <Fragment>
            <Box>
                <FormBuilder
                    inputs={[
                        {
                            type: 'text',
                            selector: 'person_name',
                            label: 'Name',
                        },
                        {
                            type: 'text',
                            selector: 'person_family',
                            label: 'Family',
                        },
                    ]}
                    ref={builderRef}
                />
            </Box>
            <Box mt={1}>
                <Button color="success" onClick={getValues}>
                    Get
                </Button>
                <Button color="secondary" onClick={setValues}>
                    Set
                </Button>
                <Button color="primary" onClick={clear}>
                    clear
                </Button>
            </Box>
        </Fragment>
    )
}

Component Props:

| key | description | link | | ------ | ----------- | ------------------------ | | inputs | inputs data | usage | | ref | react ref | - |

Ref Avilable Methods:

| key | description | usage | | --------- | -------------------------------- | ------------------------- | | getValues | get value data from form builder | usage | | setValues | set your data into inputs | usage | | clear | clear all inputs data | usage |

Get Values Prop

builderRef.current?.getValues() usage:

{
    data: {
        person_name: 'ENTERED VALUE'
        person_family: 'ENTERED VALUE'
    },
    validation: {
        status: boolean,
        inputs: []
    }
}

Set Values Prop

builderRef.current?.setValues() usage:

builderRef.current
    ?.setValues({
        tid: 1,
        person_name: 'john',
        person_family: 'doe',
    })
    .then(() => {
        console.log('all promises were fulfilled !')
    })

The data entered in the inputs will be set and if additional values are received, they will be returned

Clear Prop

builderRef.current?.clear() usage:

builderRef.current?.clear().then(() => {
    console.log('all promises were fulfilled !')
})

Type Of Inputs

| type | description | usage | | ------------ | ------------------ | ------------------------------------------------------- | | text | text input | text input usage | | number | number input | number input usage | | checkbox | checkbox input | checkbox input usage | | password | password input | password input usage | | autocomplete | autocomplete input | autocomplete input usage | | mobile | mobile input | mobile input usage | | otp | otp input | otp input usage | | mask | mask input | mask input usage | | date | date input | date input usage | | time | time input | time input usage | | datetime | datetime input | datetime input usage | | file | file input | file input usage | | items | items input | items input usage | | custom | custom input | custom input usage |

Basic Input Props

| key | type | description | sample | | ------------- | ---------------- | ----------- | ------ | | selector | string | - | - | | defaultValue | Input Value Type | - | - | | required | boolean | - | - | | visible | boolean | - | - | | wrapper | function | - | - | | onChangeValue | function | - | - | | getMutator | function | - | - | | setMutator | function | - | - |

License

This project is licensed under the terms of the MIT license.

Sponsoring services

mentasystem.net

back to top