Git Product home page Git Product logo

redux-form-antd's Introduction

redux-form-antd

This is bindings for redux form and redux form antd. This library should be compatible for both redux-form and react-final-form. Stories for final form are welcome.

NPM Downloads

redux-form-antd is a set of wrappers to facilitate the use of antd components with redux-form.


Live Demo ๐Ÿ‘€

Installation

Using npm:

  $ npm install --save redux-form-antd

Available Components

  • Select
  • Radio Buttons
  • DatePicker
  • MonthPicker
  • NumberField
  • TextField

Usage

Rather than import your component class from antd, import it from redux-form-antd and then pass the component class directly to the component prop of Field.

import { reduxForm, Field } from 'redux-form'
import {
  SelectField,
  TextField,
} from 'redux-form-antd'

class MyForm extends Component {
  render() {
    return (
      <form>
        <Field name="username" component={TextField} hintText="Street"/>
      </form>
    )
  }
}

// Decorate with redux-form
MyForm = reduxForm({
  form: 'myForm'
})(MyForm)

export default MyForm

or you can check stories code click

Instance API

getRenderedComponent()

Returns a reference to the UI component that has been rendered. This is useful for calling instance methods on the UI components. For example, if you wanted to focus on the username element when your form mounts, you could do:

componentWillMount() {
  this.refs.firstField    
    .getRenderedComponent() 
    .getRenderedComponent() 
    .focus()                
}

as long as you specified a ref and withRef on your Field component.

render() {
  return (
    <form>
      ...
      <Field name="username" component={TextField} withRef ref={r=>(this.textField = r)}/>
      ...
    </form>
  )
}

inspired by redux-form-material-ui by ericas

redux-form-antd's People

Contributors

zmitry avatar calpa avatar

Stargazers

 avatar

Watchers

James Cloos avatar Erik Rasmussen 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.