Skip to main content

atoms

Button

The single <button> primitive. It owns the accessibility baseline, and callers add classes, attributes, and content on top.

Specimens

Unstyled The baseline alone, with a focus-visible ring, disabled styling, and type="button".
{{ Button.render({ label: "Button" }) }}
Call to action
{{ Button.render({ label: "Get in touch", variant: "cta" }) }}
Submit The stamped form action. The trailing arrow is a CSS `after:` pseudo-element, not part of the label.
{{ Button.render({ label: "Send", type: "submit", variant: "submit" }) }}
Dark Used for the lightbox Close, over a dark backdrop.
{{ Button.render({ label: "Close", variant: "dark" }) }}
Icon Outlined, icon-only. The accessible name comes from aria-label.
{% call Button.render({ variant: "icon", attrs: 'aria-label="Close"' }) %}
  <span aria-hidden="true">×</span>
{% endcall %}
Disabled
{{ Button.render({ label: "Sending…", variant: "cta", attrs: "disabled" }) }}
Markup content A call body replaces the label, so icons and spans work.
{% call Button.render({
  classes: "inline-flex items-center gap-2 rounded px-3 py-2 bg-neutral-800 text-neutral-100 hover:bg-neutral-700",
  attrs: 'aria-label="Open the drawer"'
}) %}
  <span aria-hidden="true">☰</span> Menu
{% endcall %}

Params

ParamTypeDefaultDescription
typestring"button"button, submit, or reset. The default avoids accidental form submits.
labelstring"Button"Text content. Ignored when called with {% call %}.
variantstringnone"cta" | "submit" | "dark" | "icon". Omit for an unstyled button. See Variants.
classesstring | variant map | arraynoneAppended to the baseline through the classes filter.
focusColorstring"focus-visible:outline-primary-500"Ring colour utility. A separate param so a caller can recolour the ring without two colour utilities conflicting.
attrsstringnoneRaw extra attributes (aria-*, data-*, id, disabled). Rendered with | safe: escape interpolated values (build the string in a {% set %} block, where autoescape applies).

Notes

Add a look as a named variant, not a new param. A caller's focusColor replaces the ring colour without two colour utilities competing.