Skip to main content
spaday-vaadin logo, a brace and chevron inside a browser window

Typed Vaadin web components and browser assets for spaday.

Build Status codecov License PyPI

Preview of vaadin components in spaday rendering a fulfillment cockpit

Overview

from spaday import SetField, element, serve
from spaday_vaadin import VaadinButton, VaadinGrid, VaadinGridColumn, VaadinTextField

page = element("div").child(
    VaadinButton(theme="primary").text("Approve").on("click", SetField("state", "approved")),
    VaadinTextField(label="State", readonly=True).bind("value", "state"),
    VaadinGrid(items=[{"name": "Ada"}, {"name": "Grace"}]).child(VaadinGridColumn(path="name")),
)
serve(page, packages=["vaadin"], store={"state": "pending"})

A curated core of Vaadin's free components — button, checkbox, combo box, date picker, dialog, grid and its columns, notification, select, tabs and text field, 20 elements in all — has typed classes generated from their Custom Elements Manifests, so props, events and slots are checked when you author the tree. Array properties such as a grid's items are keyword arguments too, set on the element as properties. Installing the package does not inject assets; select it with packages=["vaadin"] or pass the exported package descriptor.

Generic controls

Selecting the vaadin package also selects its design, rendering spaday's generic button, text input, date input, checkbox, select, and dialog as Vaadin 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=["vaadin"], design="vaadin", store={"name": ""})

The other seven generic controls use spaday's marked native fallback because they are outside this package's curated Vaadin subset or require a rendering contract the generic API cannot preserve. Text inputs with a non-text type, such as password or email, also use the native fallback because this package's curated subset contains vaadin-text-field only.

Browser examples

  • Fulfillment desk — complete interactive example, with Python running in Pyodide.
  • Component gallery — the current curated 20-wrapper subset and its Python source.

Run the local example

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

Open http://127.0.0.1:8027 for the fulfillment desk: a grid of orders streamed live from Python with selection, sorting and filtering, shipping the selected orders through a Python endpoint, an order form of combo box, text field, select, date picker and checkbox two-way bound to spaday state, a dialog confirming what the server created, tabs, Lumo badges, and a dark mode that re-themes Lumo and the spaday shell together.

Run python -m spaday_vaadin.gallery and open http://127.0.0.1:8028 for the curated local component gallery.

Theming

The elements are styled with Vaadin's Lumo theme, and the stylesheet maps spaday's --spa-* shell palette onto Lumo's properties, so restyling Lumo restyles the shell and every other spaday component package with it. TOKENS lists the properties wired to the palette:

App().css(lumo_primary_color="#0C4253")

The theme follows spaday's page mode: a wa-dark class (for example App(...).bind_root_class("wa-dark", "dark")) switches Lumo to dark, and a wa-light island inside a dark page stays light.

Sharing Vaadin with your own library

Vaadin registers global custom element names, so a page can hold only one copy. The package serves Vaadin's modules under their own bare specifiers — @vaadin/button, @vaadin/grid/…, @vaadin/component-base/… and the other packages these elements are built from — through the page's import map. A library that imports or extends them and leaves those imports out of its bundle (external: ["@vaadin/*"] with esbuild) gets this copy.

The served copy carries the opt-out of Vaadin's development-time usage statistics, which its package normally installs at npm install time.

Metadata

Release files for spaday-vaadin 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-vaadin 0.3.0
File Size Uploaded
spaday_vaadin-0.3.0.tar.gz 370.6 kB Details

Built distribution (wheel)

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

Total release size: 931.3 kB

Release files / spaday_vaadin-0.3.0.tar.gz

Download URL spaday_vaadin-0.3.0.tar.gz
Size 370.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0289aead868b4910536b208dafecf3f71f952f8ad06df76e03596d52fdbe664b
BLAKE2b-256 checksum
How to use checksums
dbaaea338f32a3ff0a7fe691a80dc8d6f475dda20f374c560ab46ed1da4908c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

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

Download URL spaday_vaadin-0.3.0-py3-none-any.whl
Size 560.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91c559fee838d2ea59512eaaf8692e7ceeeb2bdd53464016d6c8cef337905f5e
BLAKE2b-256 checksum
How to use checksums
4eb57bf813c3f480a747023204302fe701251ecb36d80c18ba9571c97585c3bc
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