layout-cluster
Horizontal flex layout with wrapping. Ideal for groups of inline elements like buttons, tags, and navigation items.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
data-layout-gap |
xs, s, m, l, xl |
s |
Controls the gap between items |
data-layout-justify |
start, end, center, between |
start |
Controls horizontal distribution of items |
data-layout-align |
start, end, center, stretch, baseline |
center |
Controls vertical alignment of items |
data-layout-nowrap |
boolean | - | Prevents items from wrapping to new lines |
data-layout-overlap |
xs, s, m, l, or boolean |
- | Creates overlapping items (for avatar groups, stacked cards) |
Gap Variants
The data-layout-gap attribute controls spacing between items.
Cluster with gap variant
<layout-cluster data-layout-gap="xs"> <button type="button">Button</button> <button type="button">Button</button> <button type="button">Button</button></layout-cluster>
Justify Variants
The data-layout-justify attribute controls horizontal distribution.
Cluster justify variants
<!-- Items aligned to start (default) --><layout-cluster data-layout-justify="start">...</layout-cluster> <!-- Items centered horizontally --><layout-cluster data-layout-justify="center">...</layout-cluster> <!-- Items aligned to end --><layout-cluster data-layout-justify="end">...</layout-cluster> <!-- Items spread with space between --><layout-cluster data-layout-justify="between">...</layout-cluster>
Align Variants
The data-layout-align attribute controls vertical alignment.
Cluster align variants
<!-- Items aligned to top --><layout-cluster data-layout-align="start">...</layout-cluster> <!-- Items centered vertically (default) --><layout-cluster data-layout-align="center">...</layout-cluster> <!-- Items aligned to bottom --><layout-cluster data-layout-align="end">...</layout-cluster> <!-- Items stretched to fill height --><layout-cluster data-layout-align="stretch">...</layout-cluster> <!-- Items aligned by text baseline --><layout-cluster data-layout-align="baseline">...</layout-cluster>
Overlap Variant
The data-layout-overlap attribute creates overlapping items - useful for avatar groups and stacked card effects.
Control overlap amount with size values:
Overlapping avatar group
<layout-cluster data-layout-overlap> <user-avatar><img src="user1.jpg" alt="User 1" /></user-avatar> <user-avatar><img src="user2.jpg" alt="User 2" /></user-avatar> <user-avatar><img src="user3.jpg" alt="User 3" /></user-avatar> <user-avatar><span data-fallback>+3</span></user-avatar></layout-cluster>
Usage Examples
Button Group
Button group
<layout-cluster data-layout-gap="s"> <button type="button">Save</button> <button type="button" class="secondary">Cancel</button> <button type="button" class="ghost">Reset</button></layout-cluster>
Tag Cloud
Tag cloud
<layout-cluster data-layout-gap="xs"> <span class="tag">HTML</span> <span class="tag">CSS</span> <span class="tag">JavaScript</span></layout-cluster>
Card Footer Actions
Card footer with nested clusters
<layout-cluster data-layout-gap="s" data-layout-justify="between"> <layout-cluster data-layout-gap="xs"> <button type="button">Edit</button> <button type="button">Delete</button> </layout-cluster> <button type="button">View Details</button></layout-cluster>
Navigation
Navigation bar
<layout-cluster data-layout-gap="l" data-layout-justify="between"> <span class="logo">Logo</span> <layout-cluster data-layout-gap="m"> <a href="#">Home</a> <a href="#">About</a> <a href="#">Services</a> <a href="#">Contact</a> </layout-cluster></layout-cluster>
Related
<layout-stack>— Vertical stacking layout<layout-grid>— Auto-fit grid layout<layout-sidebar>— Two-column layout with sidebar<user-avatar>— Avatar element for use with overlap