1.1.9 • Published 11 months ago

form-snippet v1.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

FORM SNIPPET

form-snippet is a React package that provides a simple and flexible way to handle forms with custom components.

Badges

MIT Licenseform-snippetNPM Downloadsnpm bundle size

Installation

Install form-snippet with npm

  npm install form-snippet

Install form-snippet with github packages

  npm install @git21221/form-snippet@latest

Usage/Examples

A signup form using form-snippet, took less than 50 lines of code and proper validation.

import React from "react";
import {
  Button,
  Input,
  FormWrapper,
  SelectInput,
} from "@git21221/form-snippet";
import { months, dates, years, skills } from "./data/data";

function App() {
  const handleSubmit = (data) => {
    console.log(data);
  };

  return (
    <FormWrapper onSubmit={handleSubmit}>
      <div className="max-w-[400px] p-3 flex flex-col gap-3 shadow-2xl rounded-lg">
        <h1 className="text-xl">Signup using form-snippet</h1>
        <div className="flex gap-3">
          <Input
            name="fName"
            label="First Name"
            required
            type={"text"}
            fullWidth
          />
          <Input
            name="lName"
            label="Last Name"
            required
            type={"text"}
            fullWidth
          />
        </div>
        <div className="">
          <Input
            name="pass"
            label="Password"
            type="password"
            fullWidth
            endIcon
          />
        </div>
        <div className="">
          <Input
            name="mobile"
            label="Mobile number or email"
            type={"text"}
            fullWidth
          />
        </div>
        <div className="flex gap-3">
          <SelectInput
            name="month"
            label="Month"
            options={months}
            required
            fullWidth
          />
          <SelectInput
            name="date"
            label="Date"
            options={dates}
            required
            fullWidth
          />
          <SelectInput
            name="year"
            label="Year"
            options={years}
            required
            fullWidth
          />
        </div>
        <div>
          <SelectInput
            name="skills"
            label="Skills"
            options={skills}
            fullWidth
            multiple={{ checkBox: true }}
            renderStyle={"chip"}
          />
        </div>
        <Button content={"Submit"} />
      </div>
    </FormWrapper>
  );
}

export default App;

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Authors

Original author of form-snippet

License

MIT

1.1.9

11 months ago

1.1.8

12 months ago

1.1.7

12 months ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.29

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.28

1 year ago

1.0.0

1 year ago

1.0.27

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

24.7.1

1 year ago