Example:
A template for a collapsible container used by the legends sidebar. Adjusts to the max width of the element it is placed in, to specify width use a div element with fixed width.
Usage:
{{LegendsSidebarContainer|title||contents}}
Result: