{{#liquid-spacer}}

{{#liquid-spacer}} is a component that animates its own width and height to match the width and height of its content. Unlike the other template helpers, it doesn't run arbitrary animations or use transition rules. It just manages smoothly growing and shrinking a container, whenever the stuff inside changes.

Options

growDuration
The maximum amount of time to spend growing. For small changes, we may spend less than this time depending on growPixelsPerSecond. Defaults to 250 milliseconds.
growPixelsPerSecond
The minimum speed in at which we will grow. Defaults to 200 pixels per second. This lets us make small size adjustments in times shorter than a full growDuration.
growEasing
A Velocity easing function to use when growing the container height and width. Defaults to 'slide'.
growWidth, growHeight
Boolean options (defaulting to true) to control whether to grow horizontally and vertically. Useful for fluid-width or fluid-height content which will grow in height or width.
enabled
Whether to animate height and width changes. Defaults to true.

Demo

This is a long message. This is a long message. This is a long message. This is a long message. This is a long message. This is a long message. This is a long message. This is a long message.
<div id="liquid-spacer-demo">
  <label>{{input type="checkbox" checked=showLongMessage}} Show Long Message</label>
  {{#liquid-spacer growDuration=250}}
    {{#if showLongMessage}}
      {{longMessage}}
    {{else}}
      {{shortMessage}}
    {{/if}}
  {{/liquid-spacer}}
</div>