in Gutenberg, Plugins, WordPress

A Gutenberg MultiSelect component

This is a little adaptation of the FormTokenField found in Gutenberg core.

Working on the Custom Layouts plugin, I needed a multiselect for it’s layout block and editor options.

There are some cool controls already in Gutenberg for selecting a page, or choosing tags, but they are not actual multiselect – that is, a set of options presented to the user to choose from, and the ability to select multiple (this is just my opinion, not definition…).

The existing compontents require search/input before displaying options, whereas I wanted to show all options on interaction. While I can see it is not planned to add this into the current components system, I think it will be covered by G2 Components – so consider this a filler, until that time.

You can get the source code here.

I hope you will find it handy – happy coding (and hurry up G2, thanks…)