This can be achieved by combining two math commands:
Start by searching for dmathop that allows to place symbols over and under any symbol:
In the middle square insert the arrow you like, for example, longrightarrow:
Then type the additional information in the top (bottom) square.
Here is a final example:

The unfilled box will disappear once inserting into document.

