Examples
14 self-contained example apps that ship with Weaverlet, ordered by complexity. Each one runs standalone. Copy the script, save it, run it. Pages 01-10 only need pip install weaverlet; pages 11-14 need pip install "weaverlet[examples]" for Dash Bootstrap / Dash Mantine.
The source files live in examples/ in the Weaverlet repo.
Basics
| # | Page | Demonstrates |
|---|---|---|
| 01 | Hello World | Minimal layout-only component |
| 02 | Echo | Layout + callbacks + Identifier |
| 03 | Greeting | Constructor-injected state |
Routing
| # | Page | Demonstrates |
|---|---|---|
| 04 | Router | Multipage with SimpleRouterComponent |
| 05 | Auth router | Session-protected routes via AuthRouterComponent |
| 06 | Redirect | Programmatic redirect from a callback |
Signals
| # | Page | Demonstrates |
|---|---|---|
| 07 | Signal input | Signals carrying a payload |
| 08 | Signal trigger | Edge-only triggers |
| 09 | Signal chain | Chained signal pipeline |
| 10 | Div signal | Signal-driven element updates |
Dash Bootstrap & Dash Mantine
| # | Page | Demonstrates |
|---|---|---|
| 11 | DBC single | Single-page Weaverlet + Dash Bootstrap |
| 12 | DBC multipage | Multipage with DBC navbar |
| 13 | DBC modal | DBC modal triggered by a signal |
| 14 | DMC + keep_mounted | Dash Mantine + AppShell + state preservation |
How to use this gallery
- New to Weaverlet? Start with 01 Hello World and walk through in order. Each example builds on the previous.
- Looking for a specific pattern? Use the table above as an index. The "Demonstrates" column tells you what each example showcases without making you open it.
- Already familiar with Dash? Jump to 04 Router for the routing story, 07 Signal input for inter-component communication, and 14 DMC +
keep_mountedfor the v0.3 hero feature.
Code conventions in the gallery
The on-disk scripts use the legacy from weaverlet.base import ... / from weaverlet.components import ... import style. This still works in 0.3+ but the modern equivalent is from weaverlet import ... (everything is re-exported from the top level). The script in Example 14 uses the modern style; new code should follow that pattern.
A few other things you'll see consistently:
- Each component subclasses
WeaverletComponent, implementsget_layout, and (when it has callbacks)register_callbacks(self, app). - IDs are class-level
Identifier()descriptors, accessed asself.<identifier>inside layouts and callbacks. Never string literals. - Callbacks use
dash_extensions.enrich(Input,Output,Trigger,Serverside) rather thandash.dependencies.WeaverletApp.appis aDashProxy, so the enrich types unlockgroup=multi-output, server-side caching, etc.
See Components for the full contract.