
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
multi-select-react
Advanced tools
Multi Select React – A React Component providing multi select and single select functionality.
A React Component providing multi select and single select functionality.(under development)
npm install multi-select-react
import React, { Component } from 'react';
import MultiSelectReact from 'multi-select-react';
class MyComponent extends Component {
constructor() {
super();
this.state = {
multiSelect: []
};
}
render() {
const selectedOptionsStyles = {
color: "#3c763d",
backgroundColor: "#dff0d8"
};
const optionsListStyles = {
backgroundColor: "#dff0d8",
color: "#3c763d"
};
return (
<MultiSelectReact
options={this.state.multiSelect}
optionClicked={this.optionClicked.bind(this)}
selectedBadgeClicked={this.selectedBadgeClicked.bind(this)}
selectedOptionsStyles={selectedOptionsStyles}
optionsListStyles={optionsListStyles} />
);
}
optionClicked(optionsList) {
this.setState({ multiSelect: optionsList });
}
selectedBadgeClicked(optionsList) {
this.setState({ multiSelect: optionsList });
}
}
import React, { Component } from 'react';
import MultiSelectReact from 'multi-select-react';
class MyComponent extends Component {
constructor() {
super();
this.state = {
multiSelect: []
};
}
render() {
const selectedOptionsStyles = {
color: "#3c763d",
backgroundColor: "#dff0d8"
};
const optionsListStyles = {
backgroundColor: "#dff0d8",
color: "#3c763d"
};
return (
<MultiSelectReact
options={this.state.multiSelect}
optionClicked={this.optionClicked.bind(this)}
selectedBadgeClicked={this.selectedBadgeClicked.bind(this)}
selectedOptionsStyles={selectedOptionsStyles}
optionsListStyles={optionsListStyles}
isSingleSelect={true} />
);
}
optionClicked(optionsList) {
this.setState({ multiSelect: optionsList });
}
selectedBadgeClicked(optionsList) {
this.setState({ multiSelect: optionsList });
}
}
Default value for isSingleSelect is false, for using this component as normal single select component set isSingleSelect to true.
import React, { Component } from 'react';
import MultiSelectReact from 'multi-select-react';
class MyComponent extends Component {
constructor() {
super();
this.state = {
multiSelect: []
};
}
render() {
const selectedOptionsStyles = {
color: "#3c763d",
backgroundColor: "#dff0d8"
};
const optionsListStyles = {
backgroundColor: "#dff0d8",
color: "#3c763d"
};
return (
<MultiSelectReact
options={this.state.multiSelect}
optionClicked={this.optionClicked.bind(this)}
selectedBadgeClicked={this.selectedBadgeClicked.bind(this)}
selectedOptionsStyles={selectedOptionsStyles}
optionsListStyles={optionsListStyles}
isTextWrap={true} />
);
}
optionClicked(optionsList) {
this.setState({ multiSelect: optionsList });
}
selectedBadgeClicked(optionsList) {
this.setState({ multiSelect: optionsList });
}
}
Default value for isTextWarp is true, for component to grow vertically and display all options selected set isTextWarp to false.
Prop | Type | Default | Description |
---|---|---|---|
selectedOptionsColor | object | {} | CSS for MultiSelect options selected badges |
optionsListStyles | object | {} | CSS for MultiSelect options drop down |
options | array | R | Options to be pre-populated in select |
optionClicked | function | R | Callback, invoked after an option is clicked |
selectedBadgeClicked | function | R | Callback, invoked after an selected option badge |
isSingleSelect | boolean | Optional | Boolean value for single select functionality, component's default behavior is multi select |
isTextWrap | boolean | Optional | Boolean value for text wrap i.e selected option will expand horizontally |
[MIT]
FAQs
Multi Select React – A React Component providing multi select and single select functionality.
The npm package multi-select-react receives a total of 177 weekly downloads. As such, multi-select-react popularity was classified as not popular.
We found that multi-select-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.