extract the expandable widget.

this PR may impact #427 and #419