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

cmation-formsbuilder

v0.2.10

Published

More information coming soon.\ This project really only works if you use bootstrap 5 on your react app.\ I made this package because I use this on all projects I create.\

Downloads

12

Readme

Forms Input Controller for CMATION™

More information coming soon.
This project really only works if you use bootstrap 5 on your react app.
I made this package because I use this on all projects I create.\

If you want a simple way to create forms with React & bootstrap 5, this is the package for you.\

Installation

npm install cmation-formsbuilder

Sizing

I use bootstrap form-control sizing here so adding the attribute

inputSize="lg"

would make the input field large.

inputSize="sm"

would make the input field small.
Not specifying a size will make the field size medium / normal.

Usage

Text Input Field

import { FormInput } from 'cmation-formsbuilder';

let errors = [];
errors.name = "This field is required";
    
<FormInput 
    type="text"
    name="email"
    label="Email"
    placeholder="Enter your email"
    value={name}
    floatingLabel={true}
    onChange={value => setEmail(value)}
    error={errors.name}
/>
<FormInput 
    type="text"
    name="email"
    label="Email"
    inputSize="lg"
    placeholder="Enter your email"
    value={name}
    onChange={value => setEmail(value)}
    error={errors.name}
/>
<FormInput 
    type="text"
    name="email"
    label="Email"
    placeholder="Enter your email"
    value={name}
    onChange={value => setEmail(value)}
    error={errors.name}
/>
<FormInput 
    type="text"
    name="email"
    label="Email"
    inputSize="sm"
    placeholder="Enter your email"
    value={name}
    onChange={value => setEmail(value)}
    error={errors.name}
/>

Textarea Input Field

<FormInput 
    type="textarea"
    name="message"
    label="Message"
    placeholder="Type your message here"
    value={name}
    onChange={value => setMessage(value)}
    error={errors.name}
/>

Toggle

acts like a boolean filed 1 or 0 / true or false

<FormInput
    type="toggle"
    label="Active"
    name="active"
    value={active}
    hideBorder={true}
    onChange={(value) => setActive(value)}
/>

Example React Component

I am only including the return statement to keep the example short. This is a sample sign in component.

return (
    <div className="card">
        <div className="card-body">
            <div className="m-sm-4">
                <div className="text-center">
                    <h1 className="h2">sign in</h1>
                    <p className="lead">Sign in to the website</p>
                    {errorMessage && (
                        <div
                            className="alert alert-danger alert-dismissible fade show"
                            role="alert"
                        >
                            <div className="alert-message">{errorMessage}</div>
                        </div>
                    )}
                </div>
                <form onSubmit={(e) => e.preventDefault()}>
                    <FormInput
                        type="email"
                        id="username"
                        label="Email"
                        name="username"
                        inputSize="lg"
                        value={username}
                        hideBorder={true}
                        floatingLabel={true}
                        placeholder="Enter your email"
                        autoComplete="username"
                        onChange={(value) => setUsername(value)}
                        error={errors.username}
                    />
                    <FormInput
                        type="password"
                        id="password"
                        label="Password"
                        name="password"
                        inputSize="lg"
                        floatingLabel={true}
                        value={password}
                        hideBorder={true}
                        hideMeter={true}
                        placeholder="Enter your password"
                        autoComplete="current-password"
                        onChange={(value) => setPassword(value)}
                        error={errors.password}
                    />
                    <div className="row">
                        <div className="col-6 text-end mt-3">
                            <button className="btn btn-primary" onClick={onSubmit}>
                                <i className="fas fa-unlock-alt" /> Sign in
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
);

License

MIT