<hk-container>
hk-container: Centres its content and limits it to a maximum width with horizontal padding. Syntax, props, defaults and examples.
On this page
Centres its content and limits it to a maximum width with horizontal padding.
Group: Layout and structure. Name in the editor: Container. Complete props for every tag: Tag reference.
Syntax
<hk-container>
…
</hk-container>Children: Any content: elements, hk-* tags and text.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
max-width | number | no | - | 200 to 1920 | Max width |
padding-x (responsive) | number | no | 16 | 0 to 120 | Horizontal padding |
Responsive props: padding-x. 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/announcement-bar.snf, lines 3 to 11:
<hk-container>
<p class="sf-announcement-text">
{% if section.settings.link %}
<a href="{{ url(section.settings.link) }}">{{ section.settings.text }}</a>
{% else %}
{{ section.settings.text }}
{% endif %}
</p>
</hk-container>From docs/examples/example-store/layout/theme.snf, lines 6 to 8:
<hk-container>
<hk-text text="{{ store.name }}" size="14" />
</hk-container>From packages/templates-default/theme/sections/footer.snf, lines 2 to 15:
<hk-container>
{% if section.settings.show_newsletter %}
<div class="sf-newsletter">
<div>
{% if section.settings.newsletter_title %}
<h2 class="sf-footer-title">{{ section.settings.newsletter_title }}</h2>
{% endif %}
{% if section.settings.newsletter_text %}
<p>{{ section.settings.newsletter_text }}</p>
{% endif %}
</div>
{% if section.settings.newsletter_link %}
<hk-button
label="{{ section.settings.newsletter_label | default: t('newsletter_cta') }}"Related tags
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-heading: A heading with a level, size, alignment and colour.hk-section: A full-width band of the page with its own background and vertical padding.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.
