<hk-section>
hk-section: A full-width band of the page with its own background and vertical padding. Syntax, props, defaults and examples.
On this page
A full-width band of the page with its own background and vertical padding.
Group: Layout and structure. Name in the editor: Section. Complete props for every tag: Tag reference.
Syntax
<hk-section>
…
</hk-section>Children: Any content: elements, hk-* tags and text.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
full-bleed | boolean | no | false | - | Full bleed |
background | color | no | - | - | Background |
padding-y (responsive) | number | no | 64 | 0 to 240 | Vertical padding |
Responsive props: padding-y. Each also takes a tablet- and a mobile- prefix.
Required props
None. Every prop has a default or can be left out.
Examples
From packages/templates-default/theme/sections/page-main.snf, lines 1 to 8:
<hk-section padding-y="{{ section.settings.padding_y }}" mobile-padding-y="24">
<div class="sf-page sf-width-{{ section.settings.width }} sf-align-{{ section.settings.align }}">
{% if section.settings.show_title %}
<hk-heading text="{{ page.title }}" level="h1" size="36" mobile-size="28" />
{% endif %}
<hk-rich-text html="{{ page.body_html }}" />
</div>
</hk-section>From docs/examples/example-store/sections/announcement-bar.snf, lines 1 to 8:
<hk-section background="{{ section.settings.background }}" padding-y="12" class="announcement">
<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>
</hk-section>From packages/templates-default/theme/sections/related-products.snf, lines 2 to 11:
<hk-section padding-y="{{ section.settings.padding_y }}" mobile-padding-y="24">
{% if section.settings.title %}
<hk-heading text="{{ section.settings.title }}" level="h2" size="28" mobile-size="22" />
{% endif %}
<div class="sf-grid sf-cols-{{ section.settings.columns }}">
{% for p in collection(section.settings.collection).products limit: section.settings.limit %}
{% render 'product-card', product: p, card_style: section.settings.card_style, image_ratio: section.settings.image_ratio, show_price: section.settings.show_price, show_badge: section.settings.show_badge %}
{% endfor %}
</div>
</hk-section>Related tags
hk-container: Centres its content and limits it to a maximum width with horizontal padding.hk-stack: Lays its children out in a row or a column with a gap, alignment and wrapping.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.
