Build your component library.

Beautifully designed components built for Caspian. Accessible. Customizable. Open Source.

Maddex fills the gap between Caspian's raw power and modern UI expectations. It brings the "copy-paste" philosophy of shadcn/ui to the Python ecosystem, giving you fully typed, reactive components without the JavaScript build complexity.

The Python UI Primitive

Caspian provides the server-driven engine; Maddex provides the architecture. Instead of writing raw HTML strings or fighting with Jinja templates, you treat UI as first-class Python objects.

components/ui/button.py
from casp.html_attrs import get_attributes, merge_classes
from casp.component_decorator import component

@component
def Button(**props):
    # 1. Extract style overrides
    incoming_class = props.pop("class", "")
    # 2. Merge with defaults (Tailwind v4)
    base_styles = "inline-flex items-center justify-center rounded-md text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90"
    final_class = merge_classes(base_styles, incoming_class)

    # 3. Handle Children & Attributes
    children = props.pop("children", "")
    attributes = get_attributes({
        "class": final_class
    }, props)

    return f'<button {attributes}>{children}</button>'

Why not just write HTML?

Writing raw HTML in Python strings scales poorly. Maddex wraps complex Tailwind classes, ARIA attributes, and interaction logic into reusable Python functions. This ensures consistency across your entire application and keeps your backend code readable.

Is this a React wrapper?

No. Maddex is 100% Python server-side. It generates optimized HTML that is hydrated by the lightweight PulsePoint engine. You get the component DX of React with the simplicity of a backend-driven architecture.