Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
react-draggable-multi-select
Advanced tools
A Select control built with and for ReactJS, support draggable tags in multi select
The Select control for React. Initially built for use in KeystoneJS.
Support draggable tags in multi select (isMulti = true)
Support all other react select features
sample code
<Select
className=""
isMulti
value={value}
onChange={(e) => {setVal(e); console.log(e)}}
options={options}
closeMenuOnSelect={false} //add if needed
/>
See react-select.com for live demos and comprehensive docs.
See our upgrade guide for a breakdown on how to upgrade from v2 to v3.
React Select is funded by Thinkmill and Atlassian. It represents a whole new approach to developing powerful React.js components that just work out of the box, while being extremely customisable.
Features include:
If you're interested in the background, watch Jed's talk on React Select at ReactNYC in March 2018.
See our upgrade guide for a breakdown on how to upgrade from v1 to v2.
The old docs and examples will continue to be available at v1.react-select.com.
The easiest way to use react-select is to install it from npm and build it into your app with Webpack.
yarn add react-select
Then use it in your app:
import React from 'react';
import Select from 'react--draggable-multi-select';
const options = [
{ value: 'chocolate', label: 'Chocolate' },
{ value: 'strawberry', label: 'Strawberry' },
{ value: 'vanilla', label: 'Vanilla' },
];
class App extends React.Component {
state = {
selectedOption: null,
};
handleChange = selectedOption => {
this.setState({ selectedOption });
console.log(`Option selected:`, selectedOption);
};
render() {
const { selectedOption } = this.state;
return (
<Select
value={selectedOption}
onChange={this.handleChange}
options={options}
isMulti={true}
closeMenuOnSelect={false} //add if needed
/>
);
}
}
Common props you may want to specify include:
autoFocus
- focus the control when it mountsclassName
- apply a className to the controlclassNamePrefix
- apply classNames to inner elements with the given prefixisDisabled
- disable the controlisMulti
- allow the user to select multiple valuesisSearchable
- allow the user to search for matching optionsname
- generate an HTML input with this name, containing the current valueonChange
- subscribe to change eventsoptions
- specify the options the user can select fromplaceholder
- change the text displayed when no option is selectedvalue
- control the current valueSee the props documentation for complete documentation on the props react-select supports.
You can control the following props by providing values for them. If you don't, react-select will manage them for you.
value
/ onChange
- specify the current value of the controlmenuIsOpen
/ onMenuOpen
/ onMenuClose
- control whether the menu is openinputValue
/ onInputChange
- control the value of the search input (changing this will update the available options)If you don't provide these props, you can set the initial value of the state they control:
defaultValue
- set the initial value of the controldefaultMenuIsOpen
- set the initial open value of the menudefaultInputValue
- set the initial value of the search inputReact-select exposes two public methods:
focus()
- focus the control programaticallyblur()
- blur the control programaticallyCheck the docs for more information on:
Sojin Antony
Thank you to everyone who has contributed to this project. It's been a wild ride.
If you like React Select, you should follow me on twitter
Shout out to Joss Mackison, Charles Lee, Ben Conolly, Dave Brotherstone, Brian Vaughn, and the Atlassian Design System team ❤️
MIT Licensed. Copyright (c) Jed Watson 2019.
FAQs
A Select control built with and for ReactJS, support draggable tags in multi select
The npm package react-draggable-multi-select receives a total of 90 weekly downloads. As such, react-draggable-multi-select popularity was classified as not popular.
We found that react-draggable-multi-select 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.