react-bootstrap-multiselect-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

react-bootstrap-multiselect-ts

NPM version Dependency Status devDependency Status

A multiselect component for react (with bootstrap). This is a TypeScript wrapper on top of: https://github.com/skratchdot/react-bootstrap-multiselect

Installation

npm i -S react-bootstrap-multiselect-ts

Usage

import {MultiselectProps, Multiselect} from "react-bootstrap-multiselect-ts";
 
class MultiselectWrapper extends React.Component<MultiselectProps, {}> {
    static defaultProps = {
        onChange: () => {
        },
    };
 
    protected buttonText = (options: any, checked: any) => {
        const selected = options.length;
        const all = checked[0].length;
 
        if (all === 0 || selected === 0) {
            return "Nothing selected";
        } else if (selected === all) {
            return "All selected";
        } else {
            return `${selected} options selected`;
        }
    };
    
    render(): JSX.Element {
        return (
            <Multiselect multiple
                         buttonText={this.buttonText}
                         selectAllText="Select all"
                         {...this.props}/>
        );
    }
}
 

Package Sidebar

Install

npm i react-bootstrap-multiselect-ts

Weekly Downloads

26

Version

1.0.8

License

MIT

Last publish

Collaborators

  • urakozz