Factor out a widget for the highlight selection

We want a separate widget so that we can use both in a dialog or inside
a popover.