Skip to content

Let your reactstrap input component integrate seamlessly using formik

License

Notifications You must be signed in to change notification settings

naupaw/formstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6ab3756 Â· Mar 12, 2021

History

40 Commits
Nov 3, 2020
Mar 12, 2021
Nov 3, 2020
Jul 28, 2020
Dec 1, 2019
Dec 1, 2019
Mar 12, 2021
Jan 19, 2020
Mar 12, 2021
Jan 16, 2020
Jul 28, 2020
Mar 12, 2021

Repository files navigation

Formstrap

npm version reactstrap version formik version

Let your reactstrap input component integrate seamlessly using formik

Demo

Installation

npm install bootstrap reactstrap formik formstrap

Or

yarn add bootstrap reactstrap formik formstrap

make sure both Formik, reactstrap and bootstrap installed

Basic usage

Just replace any Input / CustomInput from reactstrap to formstrap and you're done!

import Ract from 'react';
import { Formik, Form } from 'formik';
import { Input, Submit } from 'formstrap';
import { FormGroup } from 'reactstrap';

import 'bootstrap/dist/css/bootstrap.css';

const App = () => {
  const initialValues = {
    fname: 'laws',
  };

  const onSubmit = async (values, { setSubmitting }) => {
    console.log(values);
    // some await function ...
    setSubmitting(false);
  };

  return (
    <Formik initialValues={initialValues} onSubmit={onSubmit}>
      <Form>
        <FormGroup>
          <Label>Name</Label>
          <Input type="text" name="fname" />
        </FormGroup>
        <Submit withSpinner>Save</Submit>
      </Form>
    </Formik>
  );
};

Additional Props

All props is extends from default Reactstrap Input props here's the thing that we added.

<Input /> and <CustomInput />

  • withLoading?: boolean - Input is disabled when submit / isSubmitting occur
  • withFeedback?: boolean - Throw feedback when validation has error

<Submit />

  • withLoading?: boolean - Button is disabled when submit / isSubmitting occur
  • withSpinner?: boolean - Show spinner icon when submit / isSubmitting occur