2.0.0 • Published 3 years ago

vi-select v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

vi-select

select component using virtual list - antd special

NPM

Install

npm install --save vi-select

Usage

import React from "react";
import {VSelect} from "vi-select";

const array = new Array(100).fill(0).map((_, i) => i);

class App extends React.Component {
  state = {
    value: "02555346"
  };

  onChange = e => {
    console.log("You selected", e);
    this.setState({value: e});
  };

  render() {
    return (
      <VSelect
        dataSource={array}
        onChange={this.onChange}
        style={{width: 300, marginTop: 20}}
        value={this.state.value}
      >
        {item => <p>{item}</p>}
      </VSelect>
    );
  }
}

Props

PropertyTypeDescription
dataSourceany[]Data source of the select list.
placeholderstring?Placeholder of select input.
valuestring \| number?Value of select.
onChange(v?: T) => void?Call after select changed.
keyPropany?Use to identify which property should be used as value.
displayPropany?Which property should be used to show in the input box.
styleany?Style of select container.
classNamestring?Class of select container.
itemHeightnumber?Height of each list item, default is 32px.
allowClearboolean?Switch for the clear btn.
disabledboolean?Disabled select.
emptyTplReactNode?Empty template when not data.

Development

install dependencies

cd vi-select && yarn

build code

yarn build

see the examples

cd vi-select/example && yarn start

License

MIT © musicq

2.0.0

3 years ago

0.1.5

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago