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-badge>

hk-badge: A small label such as New or Sale, with a tone. Syntax, props, defaults and examples.

On this page

A small label such as New or Sale, with a tone.

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

Syntax

html
<hk-badge>text</hk-badge>

Children: Only text (and {{ }} expressions).

Props

Write props as kebab-case attributes.

PropTypeRequiredDefaultAllowed valuesEditor label
texttextno--Text
toneselectnoaccentaccent, neutral, success, warningTone

Required props

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

Examples

From packages/templates-default/theme/blocks/chip.snf, lines 1 to 1:

html
<hk-badge text="{{ block.settings.label }}" tone="{{ block.settings.tone }}" />

From docs/examples/example-store/sections/on-sale.snf, lines 10 to 10:

html
<hk-badge text="{{ t('sale') }}" tone="accent" />

From packages/templates-default/theme/blocks/product-tags.snf, lines 3 to 3:

html
{% for tag in product.tags limit: block.settings.max %}<hk-badge text="{{ tag }}" tone="neutral" />
  • 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-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.

Next steps