
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
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 143 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.