chirp_ui
chirp-ui — Reusable Kida component library for Chirp. Headless, htmx-native, zero JavaScript. Install and import:: pip install chirp-ui {%% from "chirpui/card.html" import card %%} {%% from "chirpui/modal.html" import modal, modal_trigger %%} When used with Chirp, components are auto-detected via ``PackageLoader``. For standalone Kida usage, call `get_loader`(). Call `register_filters`() to ensure bem/field_errors/html_attrs filters are available. Call `register_colors`() once per app if you use semantic color names with ``resolve_color`` / ``badge(..., color=...)`` / ``filter_chips`` (see ``docs/COMPONENT-OPTIONS.md``).
load_manifest
Return the shipped component/token manifest as a dict. Cached for the life of the process. Uses `resources` so it works both in-tree and after ``pip install chirp-ui``. Free-threading safe: ``functools.cache`` on a no-arg function is sound under 3.14t because `loads`() is pure and the first-reader wins the race without observable state drift. Example:: from chirp_ui import load_manifest manifest = load_manifest() metric_card = manifest["components"]["metric-card"] print([p["name"] for p in metric_card["params"]])
static_path
Path to chirp-ui templates (chirpui.css, chirpui.js, chirpui-alpine.js, patterns/*.svg, themes/). Use with StaticFiles to serve CSS and themes from the package:: from chirp.middleware.static import StaticFiles import chirp_ui app.add_middleware(StaticFiles( directory=str(chirp_ui.static_path()), prefix="/static" ))
get_loader
Return a PackageLoader for chirp-ui templates. Usage (manual registration without Chirp):: from kida import ChoiceLoader, Environment, FileSystemLoader from chirp_ui import get_loader env = Environment( loader=ChoiceLoader([ FileSystemLoader("templates"), get_loader(), ]) )
register_filters
Register chirp-ui filters (bem, field_errors, html_attrs) on a Chirp app. Call after App creation so chirp-ui components render correctly:: from chirp import App import chirp_ui app = App(...) chirp_ui.register_filters(app)