<hk-grid>
hk-grid: A responsive grid of columns with a gap and an optional minimum item width. Syntax, props, defaults and examples.
On this page
A responsive grid of columns with a gap and an optional minimum item width.
Group: Layout and structure. Name in the editor: Grid. Complete props for every tag: Tag reference.
Syntax
<hk-grid>
…
</hk-grid>Children: Any content: elements, hk-* tags and text.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
columns (responsive) | range | no | 3 | 1 to 12 | Columns |
gap (responsive) | number | no | 24 | 0 to 160 | Gap |
min-item | number | no | - | 80 to 600 | Min item width |
Responsive props: columns, 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/pricing.snf, lines 4 to 8:
<hk-grid columns="3" tablet-columns="1" gap="24">
{% render 'plan-card', name: section.settings.plan1_name, price: section.settings.plan1_price, details: section.settings.plan1_details, best: section.settings.best == '1', variant: 'outline' %}
{% render 'plan-card', name: section.settings.plan2_name, price: section.settings.plan2_price, details: section.settings.plan2_details, best: section.settings.best == '2', variant: 'solid' %}
{% render 'plan-card', name: section.settings.plan3_name, price: section.settings.plan3_price, details: section.settings.plan3_details, best: section.settings.best == '3', variant: 'outline' %}
</hk-grid>From docs/examples/example-store/sections/testimonials.snf, lines 5 to 9:
<hk-grid columns="3" mobile-columns="1" gap="16">
{% for block in section.blocks %}
<hk-block of="{{ block }}" />
{% endfor %}
</hk-grid>Related tags
hk-card: A box with background, radius, padding, border and shadow around its content.hk-product-card: A product card for a product, customizable through named parts.hk-image: An image with alt text, dimensions, aspect ratio, fit, loading mode and radius.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-stack: Lays its children out in a row or a column with a gap, alignment and wrapping.hk-section-group: Marks where a shared section group (header, footer, announcement) sits in a layout.
