<hk-button>
hk-button: A button or link with a label, destination, variant, size and optional icon. Syntax, props, defaults and examples.
On this page
A button or link with a label, destination, variant, size and optional icon.
Group: Navigation and forms. Name in the editor: Button. Complete props for every tag: Tag reference.
Syntax
<hk-button />Children: None. The tag is self-closing.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
label | text | no | "" | - | Label |
href | link | no | # | - | Link |
variant | select | no | solid | solid, outline, ghost | Style |
size | select | no | md | sm, md, lg | Size |
icon | select | no | - | arrow-left, arrow-right, arrow-up-right, chevron-left, chevron-right, chevron-down, chevron-up, check, x, plus, minus, menu, search, shopping-cart, shopping-bag, heart, star, user, mail, phone, map-pin, truck, package, gift, tag, credit-card, wallet, banknote, percent, clock, calendar, download, upload, file, file-text, image, play, pause, volume-2, globe, lock, shield-check, info, alert-circle, help-circle, message-circle, share-2, external-link, link, copy, trash-2, settings, filter, sliders-horizontal, grid, list, home, store, sparkles, zap, flame, trophy, gamepad-2, headphones, monitor, smartphone, book-open, graduation-cap, code, layers, key, cpu, cable, chart-no-axes-column, radio-tower, battery-charging, plug, wrench | Icon |
icon-position | select | no | start | start, end | Icon position |
Required props
None. Every prop has a default or can be left out.
Examples
From packages/templates-default/theme/sections/footer.snf, lines 14 to 18:
<hk-button
label="{{ section.settings.newsletter_label | default: t('newsletter_cta') }}"
href="{{ section.settings.newsletter_link }}"
variant="outline"
/>From docs/examples/example-store/sections/product-grid.snf, lines 6 to 6:
<hk-button label="{{ t('view_all') }}" href="/collections/featured" variant="ghost" />From packages/templates-default/theme/snippets/button.snf, lines 1 to 1:
{% if label %}<hk-button label="{{ label }}" href="{{ href }}" variant="{{ style }}" />Related tags
hk-search-form: The store search form with placeholder, label and button text.hk-pagination: Page links for a paginated list.
