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 viaPackageLoader.
For standalone Kida usage, callget_loader().
Callregister_filters() to ensure bem/field_errors/html_attrs filters are available.
Callregister_colors() once per app if you use semantic color names with
resolve_color / badge(..., color=...) / filter_chips (see docs/COMPONENT-OPTIONS.md).
chirp_ui
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
Return the shipped component/token manifest as a dict.
Cached for the life of the process. Usesresourcesso
it works both in-tree and after …
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…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(…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…
load_manifest
function
def load_manifest() -> dict[str, Any]
Return the shipped component/token manifest as a dict.
Cached for the life of the process. Usesresourcesso
it works both in-tree and afterpip install chirp-ui. Free-threading
safe:functools.cacheon a no-arg function is sound under 3.14t
becauseloads() 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"]])
No parameters.
static_path
function
def static_path() -> 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"
))
No parameters.
get_loader
function
def get_loader() -> PackageLoader
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(),
])
)
No parameters.
register_filters
function
def register_filters(app: TemplateFilterApp) -> None
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)
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
app
|
TemplateFilterApp
|
— |
View source · /home/runner/work/chirp-ui/chirp-ui/site/../src/chirp_ui/__init__.py:1