Skip to content

CarloSaccone/react-bootstrap-input-old

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-bootstrap-input

This package provides a simple yet powerful input component with the following features:

  • pattern-based validation
  • form-group validation
  • data-binding
  • input-masks and formatting

basics

Create a host component representing your form (a filter form in this example), then place in the render function a few input fields:

<SimpleInput
    formObj={filter}
    name="email"
    placeholder="Your email"
    onChange={filterChange}
    required
    validated
    pattern={'^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$'}
    errorMessage="Please provide a valid email address"
/>

Provide the data-variable representing your form ahd the change function:

const [filter, setfilter] = useState({});
const filterChange = updatedItem => {
    setfilter(updatedItem);
};

Enjoy! demo

This project was bootstrapped with Create React App.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published