Skip to content
Hekana Spray
Documentation
Getting started
Theme development
Components and tags

Localization

Apps and custom code

Examples and recipes
API reference
Publishing
Build apps
AI development

<hk-image>

hk-image: An image with alt text, dimensions, aspect ratio, fit, loading mode and radius. Syntax, props, defaults and examples.

On this page

An image with alt text, dimensions, aspect ratio, fit, loading mode and radius.

Group: Text and media. Name in the editor: Image. Complete props for every tag: Tag reference.

Syntax

html
<hk-image />

Children: None. The tag is self-closing.

Props

Write props as kebab-case attributes.

PropTypeRequiredDefaultAllowed valuesEditor label
srcimageno--Image
alttextno""-Alt text
widthnumberno-16 to 2400Width
heightnumberno-16 to 2400Height
sizestextno100vw-Image sizes
aspect-ratioselectno-1/1, 4/5, 3/4, 16/9, 21/9Aspect ratio
fitselectnocovercover, containFit
loadingselectnolazylazy, eagerLoading
radiusnumberno-0 to 200Radius

Required props

None. Every prop has a default or can be left out.

Examples

From packages/templates-default/theme/snippets/product-card.snf, lines 4 to 9:

html
<hk-image
  src="{{ product.image }}"
  alt="{{ product.title }}"
  aspect-ratio="{{ image_ratio }}"
  sizes="(min-width: 1024px) 25vw, 50vw"
/>

From packages/templates-default/theme/sections/hero.snf, lines 25 to 31:

html
<hk-image
  src="{{ section.settings.image }}"
  alt="{{ section.settings.image_alt }}"
  loading="eager"
  aspect-ratio="4/5"
  sizes="(min-width: 1024px) 40vw, 100vw"
/>

From packages/templates-default/theme/sections/cart-main.snf, lines 10 to 10:

html
<hk-image src="{{ section.settings.empty_image }}" alt="" width="240" />
  • hk-heading: A heading with a level, size, alignment and colour.
  • 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-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.

Next steps