when href is given. Never a clickable div.") %}
{% for v in variants["button"] %}
{{ button(v, variant=v) }}
{% endfor %}
{% for s in sizes["button"] %}
{{ button("size " ~ s, variant="primary", size=s) }}
{% endfor %}
{{ button("as a link", href="#") }}
{{ button("opens a new tab", href="#", target="_blank") }}
{{ button("downloads a file", href="#", download=True) }}
{{ button("disabled", disabled=True) }}
{{ button("no permission", unavailable_reason="Requires the tenant_admin role") }}
disabled is an action that exists and is unavailable now; it renders a
real <button disabled>. unavailable_reason is an action
this person does not have; it renders a non-interactive span with the reason. They are
different things and the component keeps them apart.
target="_blank" adds rel="noopener" by itself.
target and download apply to a link only.
{% endcall %}
{% call _section("badge", "A label, not a status indicator on its own: colour alone is not an accessible signal.") %}
{% for v in variants["badge"] %}
{{ badge(v, variant=v) }}
{% endfor %}
{% for s in sizes["badge"] %}
{{ badge("size " ~ s, variant="info", size=s) }}
{% endfor %}
{{ badge("with a tooltip", variant="quiet", title="Hover text that explains the badge") }}
{{ badge("as a link", variant="outline", size="md", href="#") }}
md is DaisyUI's default size and writes no size class.
title adds a tooltip to the label; it never replaces it.
{% endcall %}
{% call _section("alert", "role=alert interrupts a screen reader; role=status waits for a pause.") %}
{% for v in variants["alert"] %}
{{ alert("An " ~ v ~ " message.", variant=v, title=v | capitalize) }}
{% endfor %}
{% endcall %}
{% call _section("empty state", "Shown instead of a bare header, which reads as a loading failure.") %}
{{ empty_state("No runs yet",
body="A run appears here once an operation starts.",
action=button("Start a run", variant="primary")) }}
{% endcall %}
{% call _section("dialog", "title is required and has no default — an untitled dialog cannot be written.") %}
{{ dialog("styleguide-dialog",
"Delete the run?",
"This cannot be undone.",
actions=button("Delete", variant="danger")) }}
Rendered closed. 64 templates in meho hand-roll this markup, and the close button
reads aria-label="Close" in 34 of them and eleven other ways in the rest.
{% endcall %}
{% call _section("field", "Label, help and error as one unit, with the aria wiring that goes with them.") %}
{{ field("sg-plain", "Tenant") }}
{{ field("sg-help", "Tenant", help="The tenant that owns this run.") }}
{{ field("sg-error", "Tenant", value="", error="Required.") }}
The error sets aria-invalid and aria-errormessage. A field
whose error is only a red border tells a screen reader nothing is wrong.
{% endcall %}
{% call _section("table", "The caption is the accessible name — visually hidden, not omitted.") %}
{{ table(["Run", "Target", "State"],
[["r-4812", "k8s-prod", badge("done", variant="success")],
["r-4813", "vcenter-fra1", badge("running", variant="info")],
["r-4814", "bind9-edge", badge("failed", variant="error")]],
caption="Recent runs") }}
{{ table(["Run", "Target"], [], caption="No runs",
empty=empty_state("Nothing to show", body="No run has started yet.")) }}
{% endcall %}
{% call _section("pager", "An unavailable direction is a span, not a disabled button.") %}
{{ pager(1, 4, url_for=url_for) }}
{{ pager(2, 4, url_for=url_for) }}
{{ pager(4, 4, url_for=url_for) }}
{% endcall %}
{% call _section("relative time", "Twelve copies under seven names in meho; this is the one shape.") %}
{{ relative_time("2026-11-17T09:00:00Z", "2 hours ago") }}
Always a <time datetime="…">, so the machine-readable timestamp is in
the markup and the human-readable text is what is displayed.
{% endcall %}
{% call _section("icon", "Decorative icons are hidden; one that carries meaning takes a label.") %}
{{ icon(sample_svg, class="size-5") }}
{{ icon(sample_svg, label="Locked", class="size-5") }}
The component takes rendered SVG rather than owning an icon set: the artwork and its
licence stay with the app that ships it.
{% endcall %}