Comments (4)
I'm not quite sure what you mean by externally. Could you expand or maybe illustrate what you have in mind? which is to say, i might very well be open to it once i understand it!
from react-widgets.
Sure.. styles a bit out of whack, but here's a quick example:
Basically what i'd like to be able to do is set a container for the taglist that isn't the multiselect itself.
from react-widgets.
gotcha. I have actually had this need also. I think it would be tough to structure a PR that would work well in this case, and I don't think that this sort of thing makes a lot of sense in the library proper. But I do want to make sure the widgets are flexible and extensible enough that stuff like this is easy enough to do yourself. In this case I think we are already there, provided you feel comfortable using a technically private component.
This is a bit of an oversimplification, you may have to cover some edge cases (like figure out how you'd want keyboard navigation of tags to work here), but you can easily wrap this pattern up into a few components in your own code to reduce some of the wiring needed to get it working.
var Multiselect = require('react-widgets/lib/Multiselect');
var TagList = require('react-widgets/lib/MultiselectTagList');
var App = React.createClass({
getInitialState(){
return {
data: list,
values: [],
}
},
render(){
var self = this;
function onChange([value]){
self.setState({
values: self.state.values.concat(value),
// remove the value from the data list so it can't be re-selected
data: self.state.data.filter( v => v !== value)
})
}
function onDelete(val){
self.setState({
values: self.state.values.filter( v => v !== val),
data: self.state.data.concat(val)
})
}
return (<div>
<Multiselect data={this.state.data} value={[]} onChange={onChange} />
<TagList value={this.state.values} onDelete={onDelete} />
</div>)
}
})
The above is written in es6 you can look here to see the compiled es5 version
from react-widgets.
that works perfectly, thanks for the quick response!
from react-widgets.
Related Issues (20)
- ComboBox autoFocus not working
- DateTimePicker Cutting in Container make over-flow-x
- feature: change caret to X on combobox
- Multiselect defaultValue doesn't refresh when props value changes HOT 1
- Combobox has unexpected behavior when using hideEmptyPopup
- findDOMNode is deprecated in StrictMode - error HOT 7
- Error finding scss files.
- Calendar: Add option to display week numbers
- Add tailwind 3 support
- Add !default to $max-height in popup.scss
- Deprecation warning with `sass 1.62.0` HOT 2
- Custom tagListComponent HOT 1
- Unable to set tabindex on footer of calendar widget
- How to stablish the value on open DropdownList HOT 3
- Achieved
- Tailwind: [WARNING] "zindex" is not a known CSS property [unsupported-css-property] HOT 1
- Multiselect - Sort tags and options alphabetically HOT 1
- DatePicker monthFormat in version 5
- Virtualized MultiSelect
- Can not set DatePicker input id via inputProps
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-widgets.