Modal panel API

Closes #4046