-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Multiselect Component #28
Comments
Started digging at this again, but then I had a realization that we could probably use what @jomurgel is doing here (once it's complete) as a base for this: #10 (comment) His component (if updated to his latest CodePen at the end of the thread) fits the criteria above in that it:
It would just need to also be able to:
I don't think it's a 1:1 comparison, but I think once complete his work could get us like 80% of the way toward a general Multi Select component for taxonomies. Thoughts @gregrickaby @kellenmace @jomurgel? |
Did some work on this, this weekend, as a proof of concept. This doesn't have any search functionality, but takes in a simple array, outputs to list and allows for adding/removing from top bar. Branch: Usage import MultiSelect from '../../components/multiselect';
<MultiSelect value={ [ 'apples', 'oranges', 'peach', 'pears', 'plums' ] } /> The value prop takes in a simple array of strings at the moment. There is a function of the component called Other considerations will be accessibility. I think we'll need to build out something with inputs or as a select field that functions as a form element rather than divs, but since this is a proof of concept I'm not too worried about it at this moment. POC Pen: Something like https://semantic-ui.com/modules/dropdown.html or http://jedwatson.github.io/react-select/ might also be worth looking into. Both have the functionality we're looking for and the later is already built in react. Though not really WP core ready, certainly worth looking into for our uses. |
Made some progress on this today. I'm not 💯 on how the API for this component is going to work/look yet, but I'm just working to get some basic functionality in place. I refactored a few functions and got |
What about adding some thoughts on this issue? |
What We Need
We should be able to select multiple terms (categories, tags, custom taxonomy) for use specifically in the Recent Posts block, but also to be utilized wherever necessary since it will be built as a component. The way ACF currently does this works well for us:

Component should, ideally, allow for:
I don't think it necessarily needs to look exactly like the ACF example, but all of that functionality is pretty 💯 IMO.
I did do some initial research into React-based multi-select tools here: #9 (comment)
I found this one which seemed to fill the needs we have, but was not able to get it to work fully: https://github.com/JedWatson/react-select
I'm not tied to that React Select component specifically, it was just one of the nicer ones I came across in my search.
Why do we need it?
Gutenberg does not feel it important to build a multiselect out of the box: WordPress/gutenberg#1044
Per the last comment there:
This could be a cool win for us to build something useful that we need, then also get it into core Gutenberg!
The text was updated successfully, but these errors were encountered: