0.4.2 • Published 8 years ago

@fyresite/react-select v0.4.2

Weekly downloads
7
License
ISC
Repository
github
Last release
8 years ago

react-select

Base Select React Component built for internal Fyresite use.

Installation

npm install --save-dev @fyresite/react-select

Usage

import React, { Component } from 'react';
import Select from '@fyresite/react-select';

class Example extends Component {
  constructor(props) {
    super(props);
    
    this.state = {
      select: {
        value: '',
        valid: ''
      },
      options: {
        key1: "Option 1",
        key2: "Option 2"
      }
    };
  }
  
  handleChange(field, e, selectState) {
    this.setState((prevState, props) => {
      return {
        [field]: selectState
      };
    });
  }
  
  render() {
    return (
      <Select
        label="Label"
        onChange={this.handleChange.bind(this, 'select')}
        options={this.state.options}
        placeholder="Placeholder"
        ref={el => { this.select = el; }}
        validator={val => { return val === 'key2'; }}
        value={this.state.value} />
    );
  }
}
0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago