0.1.6 • Published 6 years ago

@ozylog/ui-dropdown v0.1.6

Weekly downloads
1
License
SEE LICENSE IN LI...
Repository
github
Last release
6 years ago

@ozylog/ui-dropdown

React UI Dropdown with react-jss

Travis npm

Installation

npm install @ozylog/ui-dropdown --save

Usage

<Dropdown onChange={onChangeFunc} combo required getOptions={getOptionsFunc} placeholder='Please select item' />
PropertiesTypeDescriptionExample
comboBooleanEnable comboBox mode. User can filter dropdown items based on input.
requiredBooleanActivate remove icon/button if dropdown has value. Allow dropdown to has null value.true
placeholerStringInput placeholder.
optionsArray<{text: String, value: any}>Static dropdown options. Options will be ignored if there is getOptions function.{text: 'Australia', value: {countryCode: 'AU', ...}}
getOptionsFunctionDynamic dropdown option. The function will be called when dropdown is on focus / after typing. The function should return Array<{text: String, value: any}> or Promise of Array<{text: String, value: any}>.
onChangeFunctionThe function will called when dropdown value has changed. It will return value of {text: String, value: any}.
onBlurFunctionThe function will called when dropdown is onBlur.

Usage Example

'use strict';

import React, {Component} from 'react';
import Dropdown from '@ozylog/ui-dropdown';

export default class TestComponent extends Component {
  constructor(props) {
    super(props);
  }

  onChange = () => {
    // do something
  };

  render() {
    const options = [
      {text: 'Australia', value: {name: 'Australia', countryCode: 'AU'}},
      {text: 'New Zealand', value: {name: 'New Zealand', countryCode: 'NZ'}}
    ];

    return (
      <div className='Test'>
        Test
        <Dropdown onChange={this.onChange} combo required placeholder='Please select country' options={options} />
      </div>
    );
  }
}

License

MIT

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago