A couple of options are discussed at https://github.com/jupyter-widgets/ipywidgets/pull/1727#discussion_r144482546