Skip to content

Examples

Each example here is a complete, runnable program that you can read, run, and take apart. Every worked example follows the same structure: try it, read the code, see how it works, then make it yours.

The examples on this page are deliberately small, and each one is built to show a handful of ideas clearly. The Shop and the Photo editor come closest to a full application. The project gallery points to the larger apps and to project ideas.

Worked examples

The table runs from the smallest example to the largest.

Example Shows Good after
Three linked pages Multi-page navigation with no state Build your first app
Calculator Forms and state working together Ask the user for information
Big form Every core input in one form Ask the user for information
Login flow Conditional pages from state (and why it is not security) Show different content
Pet registry Nested data: a list of dataclasses Show a collection
To-do list Adding and removing items from list state Show a collection
Shop Arguments and inventory across routes Show different content
Photo editor Uploading and transforming images Use pictures

Playground

The playground holds collections of tiny editable demos, organized by topic. You can run, change, and even break each demo directly in the page.

How to use an example

  1. Try it in the embedded app to see the behavior.
  2. Predict what one change would do, then edit the code and check.
  3. Copy it into your own editor when you want to keep going. Every listing is a complete program, including the imports and the start_server(...) call.

If none of these examples covers what you need, each task page in Add to Your App includes its own small example, and the component reference has focused snippets for each component.