@guu wrote this fantastic tutorial up, on how to implement an auto expander.
And here’s a stock image with the auto expander already implemented.