1.2.1 • Published 6 years ago

relect v1.2.1

Weekly downloads
21
License
ISC
Repository
github
Last release
6 years ago

Relect

A Tiny React Single Select Component.
Example

Install

npm i relect -S

Usage

import React  from 'react';
import Relect from 'relect';

// include styles
import 'relect/lib/relect.css';

const options = [
    { text: 'one', value: 1 },
    { text: 'two', value: 2 }
];

class App extends React.Component {

    constructor(props) {
        super(props);
        this.state = { chosen : null }
    }
    
    onChange(index) {
        this.setState({ chosen : index });
    }

    render() {
        return (
            <Relect options={options}
                    chosen={this.state.chosen}
                    onChange={this.onChange.bind(this)}
            />
        )
    }
}

Props

PropertyTypeDefaultDescription
widthnumber240width of select
heightnumber36height of select
optionsarray/options
chosennumber/index of chosen option
tabIndexnumber-1tab order
disabledboolfalsewhether to disable select
autoBlurboolfalseauto blur after selection
placeholderstring/placeholder text
optionHeightnumber30height of option
1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

7 years ago

1.0.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago