Skip to main content
spaday-lion logo, a lion face inside a browser window

Typed Lion components and browser assets for spaday.

Build Status codecov License PyPI

Preview of Lion components in spaday rendering a bank account opening page

Overview

from spaday import SetField, element, serve
from spaday_lion import LionButton, LionInput

page = element("form").child(
    LionInput(label="Name", name="name"),
    LionButton().text("Approve").on("click", SetField("state", "approved")),
    element("output").bind("textContent", "state"),
)
serve(page, packages=["lion"], store={"state": "pending"})

Every element @lion/ui registers has a typed class generated from its Custom Elements Manifest, including the attributes its form and localization mixins contribute, so props, events and slots are checked when you author the tree. Installing the package does not inject assets; select it with packages=["lion"] or pass the exported package descriptor.

Generic controls

Select the lion design to render spaday's generic controls as Lion elements:

from spaday import Button, Column, TextInput
from spaday.backends.starlette import serve

page = Column(
    TextInput(label="Name").bind("value", "name", mode="two-way"),
    Button(label="Save", intent="primary"),
)
app = serve(page, packages=["lion"], design="lion", store={"name": ""})

Lion realizes 12 of the 13 generic controls. Alert uses spaday's marked native fallback because Lion does not provide a static alert component.

Browser examples

Both run Python locally through Pyodide; no install or server is required.

Run examples locally

python -m pip install -e ".[examples]"
python -m spaday_lion.example
python -m spaday_lion.gallery

Open http://127.0.0.1:8025 for the standard account-opening app or http://127.0.0.1:8026 for the component gallery. The standard app includes a complete lion-form, two-way bindings, an endpoint-backed submission flow, a review queue streamed from Python, overlays, navigation, and shared dark-theme state. The gallery includes every generated Lion component and a highlighted Python snippet for each component family.

Both pass the local package descriptor directly, so they do not install or resolve the integration from GitHub.

Theming

Lion is white-label: its elements ship functional styles instead of a palette. Disabled form-control text follows --spa-muted by default. Override Lion's native custom property on an app or one component when it needs a different value:

from spaday import App
from spaday_lion import LionDrawer, LionInput, LionTooltip

App(
    LionInput(label="Account").css(disabled_text_color="#64748b"),
    LionTooltip().css(tooltip_arrow_width="18px", tooltip_arrow_height="11px"),
    LionDrawer().css(min_width="16rem", max_width="32rem", transition_property="width"),
)

spaday_lion.TOKENS lists all ten custom properties consumed by Lion's registered production components: disabled text, tooltip arrow dimensions, and drawer size and transition controls. Style the rest of Lion with ordinary CSS, reading the shell's tokens where they fit:

lion-button { background: var(--spa-accent); border: 1px solid var(--spa-border); }

Sharing Lion with your own library

Lion registers global custom element names, so a second copy on the page throws from customElements.define. The package serves Lion's modules under their own bare specifiers — @lion/ui/button.js, @lion/ui/define/lion-button.js, the translation modules and the rest of its exports — through the page's import map. A library built on Lion that leaves those imports out of its bundle (external: ["@lion/ui"] with esbuild) gets this copy, and nothing registers twice.

Metadata

Release files for spaday-lion 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spaday-lion 0.3.0
File Size Uploaded
spaday_lion-0.3.0.tar.gz 776.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spaday-lion 0.3.0
File Interpreter ABI Platform
spaday_lion-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / spaday_lion-0.3.0.tar.gz

Download URL spaday_lion-0.3.0.tar.gz
Size 776.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9a9b0637de8e76c63369a5efd13f831eb279f122bc8738c7b00105b2341b42cc
BLAKE2b-256 checksum
How to use checksums
307634f8954f90d5c46ba6d8d8529f4cd2a486335a3bf4b48f7affc08f252450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / spaday_lion-0.3.0-py3-none-any.whl

Download URL spaday_lion-0.3.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
02cad71a5f93a09ff05ece2c122bb2f0dd6bb30185c9c6d4fd6453783dd2c40e
BLAKE2b-256 checksum
How to use checksums
b041ea9186d58b8688fa4d4a4fa1edc5e38d7e1890ac1eab62368f85f6292e45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page