{#- chirp-ui: ASCII Tabs Route/link tab navigation using box-drawing characters with active tab highlighting. Usage: from "chirpui/ascii_tabs.html" import ascii_tabs, ascii_tab {% call ascii_tabs() %} {{ ascii_tab("overview", "Overview", active=true) }} {{ ascii_tab("details", "Details") }} {{ ascii_tab("logs", "Logs") }} {% end %} With htmx: {% call ascii_tabs() %} {{ ascii_tab("overview", "Overview", url="/tabs/overview", hx_target="#panel", active=true) }} {{ ascii_tab("details", "Details", url="/tabs/details", hx_target="#panel") }} {% end %} Variants: default, accent. Contract: navigation links, not a roving-focus tabpanel controller. Visual (active tab boxed): ┌──────────┐ │ Overview │ Details Logs └──────────┴────────────────── -#} {% def ascii_tabs(variant="", cls="") %} {% set variant = variant | validate_variant(("", "default", "accent"), "") %} {% set variant_class = " chirpui-ascii-tabs--" ~ variant if variant and variant != "default" else "" %} {% end %} {% def ascii_tab(id, label, url=none, hx_target=none, hx_swap="innerHTML", active=false, cls="") %} {% if url %} {% if active %}{% end %} {{ label }} {% if active %}{% end %} {% else %} {% if active %}{% end %} {{ label }} {% if active %}{% end %} {% end %} {% end %}