GithubHelp home page GithubHelp logo

nkrambo / formsy-semantic-ui-react Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zabute/formsy-semantic-ui-react

1.0 2.0 0.0 790 KB

Formsy-React wrappers for Semantic-Ui-React's form elements

License: MIT License

JavaScript 99.32% HTML 0.68%

formsy-semantic-ui-react's Introduction

formsy-semantic-ui-react Build Status npm version

Quicky create formsy-react forms with Semantic-Ui-React's Form Components.

Installation

npm install (or yarn add) formsy-semantic-ui-react

You will also need formsy-react

npm install (or yarn add) formsy-react

Usage

// ES6
import {
  Form, Input, TextArea, Checkbox, Radio, RadioGroup, Dropdown, Select,
} from 'formsy-semantic-ui-react';
// ES5
var Form = require('formsy-semantic-ui-react').Form;
/** and so on for the rest of the Components **/
const App = (props) => {
  const errorLabel = <Label color="red" pointing/>

  return (
    <Form
      onValidSubmit={ props.onValidSubmit }
      loading={ props.isLoading }
    >
      <Form.Input
        name="email"
        label="Email"
        validations="isEmail"
        validationErrors={{ isEmail: 'Email not valid' }}
        errorLabel={ errorLabel }
      />
    </Form>
  )
}

Props

This library defines a couple of (non-required) props for more control over behavior/markup:

  • errorLabel (type: function default: none)

    Used to Show validation errors next to the inputs. Any children get replaced by getErrorMessage()

  <Checkbox
    errorLabel={ <Label color="red" pointing="left" }/>
  />
  • instantValidation (type: bool default: false)

Whether or not to show validation errors as soon as user starts typing. Only available on Input and Form.Input

  <Input
    instantValidation
  />

Examples

Go to the example folder to see more examples of how the components are used. For more information on building and validating formsy-react forms, take a look at Formsy-React's Dcoumentaion

To run the example app:

npm/yarn install
npm/yarn run example-app

Then go to localhost:8080

Tests

Tests are done using Mocha, chai, sinon, and enzyme on jsdom. To run the tests,

npm/yarn install
npm/yarn run test // or npm run test:watch

License: MIT

formsy-semantic-ui-react's People

Contributors

zabute avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.