Skip to content

jy4618272/relect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relect

A Tiny React Single Select Component.
Example

Install

npm install relect

Usage

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

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

Property Type Default Description
width number 240 width of select
height number 36 height of select
options array / options
chosen number / index of chosen option
tabIndex number -1 tab order
disabled bool false whether to disable select
placeholder string / placeholder text
optionHeight number 30 height of option

About

A Tiny React Single Select Component.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 57.2%
  • CSS 28.9%
  • HTML 13.9%