Reusable combinations of bokeh widgets?

Hey everyone,

I have some bokeh plots which over time grew to also include interactions and more complex layouting. Some components occur multiple times, e.g. a row of colorpickers dependent on a list of strings, so that the user can pick one color for each strings which in turn influences some glyphs somewhere else. The row of colorpickers appears independently in two locations where the list of string is different (and has different meaning). The row of colorpickers must be dynamic, so when strings are added or strings are removed from the list the number of colorpickers changes.

I would like to have define the row of colorpickers once and then reuse them in multiple places. Currently I have a class which takes a list of a strings and a bokeh container and then inserts the row of color pickers into the bokeh container. When the list of strings gets updated the object is called and mutates the bokeh container. The picked colors are also available from this class.

This works “fine”, but it is weird that the combination of bokeh widgets is not a bokeh widget itself, but something separate. Does anyone have other approaches to define reusable combinations of bokeh widgets? Optimally I would like to define a python bokeh widget which client/javascript representation is made out of other bokehjs widgets. Manually that should already work (just define your custom widget and then implement the js side with bokehjs widgets), but it feels like a somewhat common usecase and that I maybe just missed an obvious idea how to do it.