atoms
Button
The single <button> primitive. It owns the accessibility baseline, and callers add classes, attributes, and content on top.
Specimens
{{ Button.render({ label: "Button" }) }}{{ Button.render({ label: "Get in touch", variant: "cta" }) }}{{ Button.render({ label: "Send", type: "submit", variant: "submit" }) }}{{ Button.render({ label: "Close", variant: "dark" }) }}{% call Button.render({ variant: "icon", attrs: 'aria-label="Close"' }) %}
<span aria-hidden="true">×</span>
{% endcall %}{{ Button.render({ label: "Sending…", variant: "cta", attrs: "disabled" }) }}{% 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
| Param | Type | Default | Description |
|---|---|---|---|
type | string | "button" | button, submit, or reset. The default avoids accidental form submits. |
label | string | "Button" | Text content. Ignored when called with {% call %}. |
variant | string | none | "cta" | "submit" | "dark" | "icon". Omit for an unstyled button. See Variants. |
classes | string | variant map | array | none | Appended to the baseline through the classes filter. |
focusColor | string | "focus-visible:outline-primary-500" | Ring colour utility. A separate param so a caller can recolour the ring without two colour utilities conflicting. |
attrs | string | none | Raw 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.