<hk-heading>
hk-heading: A heading with a level, size, alignment and colour. Syntax, props, defaults and examples.
On this page
A heading with a level, size, alignment and colour.
Group: Text and media. Name in the editor: Heading. Complete props for every tag: Tag reference.
Syntax
<hk-heading />Children: None. The tag is self-closing.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
text | text | no | "" | - | Text |
level | select | no | h2 | h1, h2, h3, h4 | Level |
size (responsive) | number | no | - | 12 to 160 | Size |
align | select | no | - | start, center, end | Align |
color | color | no | - | - | Colour |
Responsive props: size. 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/blocks/product-title.snf, lines 1 to 6:
<hk-heading
text="{{ product.title }}"
level="{{ block.settings.level }}"
size="{{ block.settings.size }}"
mobile-size="{{ block.settings.mobile_size }}"
/>From docs/examples/example-store/sections/promo-hero.snf, lines 6 to 13:
<hk-heading
text="{{ section.settings.title }}"
level="h1"
size="56"
tablet-size="44"
mobile-size="32"
color="#FFFFFF"
/>From packages/templates-default/theme/sections/hero.snf, lines 9 to 15:
<hk-heading
text="{{ section.settings.title | default: t('hero_title') }}"
level="h1"
size="52"
mobile-size="32"
color="{{ section.settings.text_color }}"
/>Related tags
hk-text: A paragraph of plain text with size, alignment and colour.hk-rich-text: Formatted text from an HTML string, sanitized before it is rendered.hk-badge: A small label such as New or Sale, with a tone.hk-image: An image with alt text, dimensions, aspect ratio, fit, loading mode and radius.hk-icon: An icon from the built-in set, with size, stroke and an accessible label.hk-announcement: A bar of up to six short messages that fade or scroll, optionally dismissible.
