<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
<hk-badge>text</hk-badge>Children: Only text (and {{ }} expressions).
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
text | text | no | - | - | Text |
tone | select | no | accent | accent, neutral, success, warning | Tone |
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:
<hk-badge text="{{ block.settings.label }}" tone="{{ block.settings.tone }}" />From docs/examples/example-store/sections/on-sale.snf, lines 10 to 10:
<hk-badge text="{{ t('sale') }}" tone="accent" />From packages/templates-default/theme/blocks/product-tags.snf, lines 3 to 3:
{% for tag in product.tags limit: block.settings.max %}<hk-badge text="{{ tag }}" tone="neutral" />Related tags
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.
