🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-select-multi

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-select-multi

React Select Multi – Component Library for UI Select Elements

1.6.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

React Select Multi

npm version Build Status Coverage Status

Description

A versatile React Component providing awesome UI select components.

  • default = basic select (single option)
  • isMultipleSelect = multiple select (multiple options)
  • isSearchable = select with search input field

State management options

  • React Component state
  • Redux

Installation

With Yarn:

yarn add react-select-multi

With NPM:

npm install react-select-multi

1. Basic Usage (SelectState): uses component state for state management

import React, { Component } from 'react';
import { SelectState } from 'react-select-multi';

class MyComponent extends Component {
  render() {
    return (
      <SelectState
        id="category-select"
        options={options}
        styles={styles}
        onCheck={onCheck}
        selected={selected}
      />
    );
  }
}

2. Basic Usage (SelectConnected): uses Redux for state management

import React, { Component } from 'react';
import { SelectConnected } from 'react-select-multi';

class MyComponent extends Component {
  render() {
    return (
      <SelectConnected
        id="select-multi-1"
        options={options}
        initialSelected={initialSelected}
        styles={styles}
        selected={selected}
      />
    );
  }
}

Configuration

  • R: required
  • ** (styles): see below

Universal Properties

PropTypeDefaultDescription
idstringRUnique identifier for the component
isMultipleSelectbooleanfalseEnable multiple options to be selected
isSearchablebooleanfalseEnable search input for options
labelstring''Label for component (above MultiSelect)
placeholderstring''Placeholder for control bar
optionsarrayROptions for MultiSelect
stylesobject**CSS class names for MultiSelect

SelectState Properties

PropTypeDefaultDescription
selectedarray[]Options that are selected; keep this updated (in combination with onCheck) in order for selected options to be updated
onCheckfuncRCallback, invoked after an option is clicked, onCheck(option.tag, isMultipleSelect)

SelectConnected Properties

PropTypeDefaultDescription
initialSelectedarray[]Options to be pre-selected

Styles

Default classNames:

styles: {
  wrapper: 'rsm-wrapper',
  label: 'rsm-label',
  controlContainer: 'rsm-control__container',
  controlPlaceholder: 'rsm-control__placeholder',
  search: 'rsm-search',
  expandIcon: 'rsm-arrow-down',
  collapseIcon: 'rsm-arrow-up',
  optionContainer: 'rsm-option__container',
  optionBar: 'rsm-option__bar',
  optionCheckbox: 'rsm-option__checkbox',
};

Tests

Run flow check

yarn flow

Run test suite

yarn spec

Run with coverage report

yarn coverage

Run linter

yarn lint

Credits

Thanks to Lyn, JD, Mike, Anoop, and 🌳

Licence

Apache-2.0

FAQs

Package last updated on 06 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts