Skip to main content
Version: 0.3.1

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

#PageDemonstrates
01Hello WorldMinimal layout-only component
02EchoLayout + callbacks + Identifier
03GreetingConstructor-injected state

Routing

#PageDemonstrates
04RouterMultipage with SimpleRouterComponent
05Auth routerSession-protected routes via AuthRouterComponent
06RedirectProgrammatic redirect from a callback

Signals

#PageDemonstrates
07Signal inputSignals carrying a payload
08Signal triggerEdge-only triggers
09Signal chainChained signal pipeline
10Div signalSignal-driven element updates

Dash Bootstrap & Dash Mantine

#PageDemonstrates
11DBC singleSingle-page Weaverlet + Dash Bootstrap
12DBC multipageMultipage with DBC navbar
13DBC modalDBC modal triggered by a signal
14DMC + keep_mountedDash Mantine + AppShell + state preservation
  • 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_mounted for the v0.3 hero feature.

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, implements get_layout, and (when it has callbacks) register_callbacks(self, app).
  • IDs are class-level Identifier() descriptors, accessed as self.<identifier> inside layouts and callbacks. Never string literals.
  • Callbacks use dash_extensions.enrich (Input, Output, Trigger, Serverside) rather than dash.dependencies. WeaverletApp.app is a DashProxy, so the enrich types unlock group= multi-output, server-side caching, etc.

See Components for the full contract.