0.0.2 • Published 5 years ago

@mazecx/semantic-ui-react-formik v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

semantic-ui-react-formik

NPM JavaScript Style Guide

Formik components using Semantic UI as presentation UI

Install

npm install --save semantic-ui-react-formik
# or
yarn add semantic-ui-react-formik

Usage

This package expose the Form components of the semantic-ui-react package wrapped with the Formik components.

List of components:

ComponentDescriptionReference
FormSugar for https://jaredpalmer.com/formik/docs/api/formik
Form.ButtonSugar for <Form.Field control={Button} />https://react.semantic-ui.com/elements/button/
Form.CheckboxSugar for <Form.Field control={Checkbox} />https://react.semantic-ui.com/modules/checkbox/
Form.DropdownSugar for <Form.Field control={Dropdown} />https://react.semantic-ui.com/modules/dropdown/
Form.GroupA set of fields can appear grouped togetherhttps://react.semantic-ui.com/collections/form/
Form.InputSugar for <Form.Field control={Input} />https://react.semantic-ui.com/collections/form/
Form.RadioSugar for <Form.Field control={Radio} />https://react.semantic-ui.com/collections/form/
Form.SelectSugar for <Form.Field control={Select} />https://react.semantic-ui.com/collections/form/
Form.TextAreaSugar for <Form.Field control={TextArea} />https://react.semantic-ui.com/collections/form/

Example

import React, {Component} from 'react'
import Form from 'semantic-ui-react-formik'
// or
// import Form, {Checkbox, Input, Radio ...} from 'semantic-ui-react-formik'

class Example extends Component {
  render() {
    return (
      <Form initialValues={{}} onSubmit={() => {}}>
        {({isSubmitting}) => (
          <>
            <Form.Input
              label="Email"
              name="email"
              type="email"
              placeholder="someemail@email.com"
            />

            <Form.Group widths="equal">
              <Form.Checkbox
                label="I like apples"
                name="preference"
                value="apple"
              />
              <Form.Checkbox
                label="and also bananas."
                name="preference"
                value="banana"
              />

              <Form.Button loading={isSubmitting} type="submit">
                Submit
              </Form.Button>
            </Form.Group>
          </>
        )}
      </Form>
    )
  }
}

License

MIT © wladiston