Example Gallery 🎨¶
Welcome to the tempestweb gallery! 🚀 Here you'll find complete, ready-to-run apps, each focused on one concept — state, forms, lists, navigation, theming, i18n, canvas, and much more.
Two modes, one codebase
Every example is a typed-Python view(app) -> Widget module. The same
app.py runs in both modes without changing a single line:
- Mode A (WASM/Pyodide) — Python straight in the browser.
- Mode B (server) — Python on a FastAPI server + a thin WebSocket client.
The view tree never names a transport. You write the logic once and pick the mode at serve time.
How to read each page
Every page follows the tutorial pattern: what you'll build → the minimal code → a piece-by-piece explanation → a Recap at the end. Start with Counter and the To-do list if you're new here.
Fundamentals¶
The building blocks — the starting point for everyone. These four are already part of the Tutorial.
- Counter — the reactive "hello world": state + handler + patch.
- To-do list — a controlled
Input, a virtualized list, and per-item checkboxes. - Form —
Form+FormField+ validators that mirror errors back onto state. - Async fetch — an
idle → loading → loadedtransition via anasynchandler.
State and data¶
Manage time, conversions, and tables fully deterministically.
- Stopwatch — Start/Stop/Lap/Reset with time stored as integer tenths-of-a-second (no wall clock).
- Temperature converter — two controlled fields (Celsius/Fahrenheit) kept in sync via two-way binding.
- Data table — live search + per-column sort toggle (ASC/DESC), all driven from Python state.
Forms and flows¶
From simple validation to a multi-step wizard.
- Login form —
EmailInput/PasswordInput, three-layer validation, and an errorBanner. - Signup wizard — three steps (Account/Profile/Review) with validators gating "Next".
- Brazilian registration — PF/PJ with CPF/CNPJ/phone/address masks and real-time BR validators.
- Quiz with score — 5 questions with
RadioGroup, aProgressBar, and a final results screen.
Layout and navigation¶
App shells, tabs, drawers, and routes.
- Tabbed profile —
TabView+RouteChangeEventwith three sections and aSwitchin settings. - Dashboard app shell —
Scaffold+AppBar+Sidebar+NavBarwith four swappable sections. - Drawer navigation & routing — a sliding
RouteDrawer, 2-level route push/pop, and aBreadcrumb. - Onboarding carousel —
PageViewwithPageChangeEvent, a dot indicator, and a completion screen.
Lists, media, and input¶
Virtualized lists, galleries, chat, search, and drag-and-drop.
- Image gallery — a virtualized 12-photo
LazyGrid+ aDialoglightbox with Prev/Next/Close. - Chat UI — a virtualized
LazyColumn, a two-wayInput, and a SendButtonwith an empty-message warning. - Search with autocomplete — live filtering via
Autocomplete+ aChipcategory filter. - Kanban board — three columns with
Draggablecards andDragTargets to move/delete.
Selection controls and feedback¶
Controls, disclosure, and feedback states.
- Settings panel —
Switch,Checkbox,Slider,RadioGroup, andSegmentedControlbound to state. - Rating & review —
Ratingstars +Chiptags + aTextAreain a validated form. - FAQ accordion — a single-open
Accordionwith a live search filter. - Notification center —
Banner, an unreadBadge, and anEmptyStatefor the empty inbox.
Theming, i18n, and canvas¶
Visual customization, internationalization, and drawing.
- Theme switcher —
Theme/ThemeModewithApp.set_theme,Theme.is_dark, and OS simulation viaMediaQueryData. - Internationalized greeting —
Locale+translate()/t()across English, Portuguese, and Arabic (RTL). - Sketch pad (canvas) — strokes as draw-command lists (
MoveTo/LineTo), presets, undo, and clear.
Native capabilities¶
The native bridge (tempestweb.native) exposes geolocation, HTTP, camera,
clipboard, share, and storage — always through injectable callables, so every
example runs deterministically in tests with a FakeBridge.
- Weather (HTTP + geolocation) — a chained
asynchandler (idle → loading → loaded/error) combininggeolocation.get_positionandhttp.request. - Copy & share — injected
clipboard.write+share.share, driving twoasynchandlers through phase transitions. - Camera capture — an
IDLE → CAPTURING → CAPTURED/ERRORlifecycle withcamera.capture, a data-URI preview, and a metadataCard. - Notes on device storage — a notes CRUD over injected
storage.put/get/list_keys/remove.
Observability¶
Telemetry, feature flags, error boundaries, and auth — the blocks that make an app production-ready.
- Feature flags —
FeatureFlagsProvider+InMemoryFeatureFlagsAdapter: two flags swap widget variants live. - Error boundary + telemetry — an
ErrorBoundarywrapping a boom-togglable child, withon_errorwired to aLogger+TelemetryProvider. - JWT auth gate —
AuthStore+route_guard, JWTs decoded offline,is_jwt_expired, and an audit trail viaLogger.
PWA and offline¶
Install-as-app and browser push notifications.
- PWA install + WebPush — a 7-phase consent flow (
notifications.request_permission/subscribe) + abuild_pwa.pyscript emitting an installable manifest and icons.
Execution modes¶
The same view running on the server, without changing a line.
- Running Mode B (server) — the counter example running unchanged on a FastAPI WebSocket server via
TestClient.
Ready to start?
Pick the example closest to what you want to build, copy its app.py, and
run it in both modes. They all pass the green gate (build, ruff, mypy
--strict). Happy coding! 💡