<hk-stack>
hk-stack: Lays its children out in a row or a column with a gap, alignment and wrapping. Syntax, props, defaults and examples.
On this page
Lays its children out in a row or a column with a gap, alignment and wrapping.
Group: Layout and structure. Name in the editor: Stack. Complete props for every tag: Tag reference.
Syntax
<hk-stack>
…
</hk-stack>Children: Any content: elements, hk-* tags and text.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
direction (responsive) | select | no | column | row, column | Direction |
gap (responsive) | number | no | 16 | 0 to 160 | Gap |
align | select | no | - | start, center, end, stretch | Align |
justify | select | no | - | start, center, end, between | Justify |
wrap | boolean | no | false | - | Wrap |
Responsive props: direction, gap. Each also takes a tablet- and a mobile- prefix.
Required props
None. Every prop has a default or can be left out.
Examples
From docs/examples/example-store/sections/announcement-bar.snf, lines 2 to 7:
<hk-stack direction="row" mobile-direction="column" gap="12" mobile-gap="4" align="center" justify="center">
<hk-text text="{{ section.settings.message }}" size="15" align="center" color="#FFFFFF" />
{% if section.settings.link_label %}
<a class="announcement-link" href="{{ section.settings.link }}">{{ section.settings.link_label }}</a>
{% endif %}
</hk-stack>From docs/examples/example-store/sections/on-sale.snf, lines 8 to 13:
<hk-stack direction="row" gap="8" align="center">
{% if p.compare_at > p.price %}
<hk-badge text="{{ t('sale') }}" tone="accent" />
{% endif %}
<hk-price amount="{{ p.price }}" compare-at="{{ p.compare_at }}" />
</hk-stack>Related tags
hk-heading: A heading with a level, size, alignment and colour.hk-text: A paragraph of plain text with size, alignment and colour.hk-button: A button or link with a label, destination, variant, size and optional icon.hk-section: A full-width band of the page with its own background and vertical padding.hk-container: Centres its content and limits it to a maximum width with horizontal padding.hk-grid: A responsive grid of columns with a gap and an optional minimum item width.hk-card: A box with background, radius, padding, border and shadow around its content.hk-section-group: Marks where a shared section group (header, footer, announcement) sits in a layout.
