Vanilla Breeze

layout-switcher

A flexbox container that automatically switches from horizontal to vertical layout based on available space. Ideal for responsive layouts without media queries.

Attributes

Attribute Values Default Description
data-layout-gap none, 3xs, 2xs, xs, s, m, l, xl, 2xl, 3xl m Gap between items, on the shared size scale.
data-layout-threshold (bare), s, m, l m Container width at which the row becomes a column: 25 / 30 / 40rem. One-off: style="--layout-threshold: 35rem".
data-layout-limit 2, 3, 4 Force the column layout once there are more than this many items.
data-layout-reverse (boolean) Reverse the visual order when stacked.

Basic Usage

Items display side-by-side when space allows, then stack vertically.

Threshold Variants

The data-layout-threshold attribute controls when the switch happens.

Item Limit

The data-layout-limit attribute forces vertical layout when there are more items than the limit.

Usage Examples

Form Actions

Card Header

Feature Comparison

Related