https://github.com/chenjiahan/relect
A Tiny React Single Select Component.
https://github.com/chenjiahan/relect
react select
Last synced: about 1 year ago
JSON representation
A Tiny React Single Select Component.
- Host: GitHub
- URL: https://github.com/chenjiahan/relect
- Owner: chenjiahan
- Created: 2015-12-04T15:35:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-03-28T17:56:54.000Z (over 2 years ago)
- Last Synced: 2025-04-23T01:55:40.233Z (about 1 year ago)
- Topics: react, select
- Language: JavaScript
- Homepage: http://chenjiahan.github.io/relect/
- Size: 1.1 MB
- Stars: 36
- Watchers: 3
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Relect
A Tiny React Single Select Component.
[Example](http://chenjiahan.github.io/relect/)
## Install
npm i relect -S
## Usage
``` javascript
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 (
)
}
}
```
## 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
autoBlur|bool|false|auto blur after selection
placeholder|string|/|placeholder text
optionHeight|number|30|height of option