Examples Guide

June 27, 2026 ยท View on GitHub

The examples/ directory contains both runnable Cargo example targets and source-only demo modules that are composed into the tour binaries.

Cargo.toml sets autoexamples = false, so only the explicit [[example]] targets below can be run with cargo run --example ....

Start Here

ExampleCommandFeaturesPurpose
hellocargo run --example hello-Smallest possible SLT app
countercargo run --example counter-State + keyboard input
democargo run --example demoqrcode, syntax optionalBroad widget overview
color_pickercargo run --example color_picker-Color picker interaction

Tour Binaries

These are the canonical way to review feature groups. Each tour pulls several source-only demos from examples/ via Rust modules.

ExampleCommandFeaturesPurpose
v020_tourcargo run --example v020_tour-v0.20 API and interaction tour
v0211_tourcargo run --example v0211_tour-v0.21.1 API additions
v0210_widgetscargo run --example v0210_widgets-v0.21.0 widget coverage
cookbook_tourcargo run --example cookbook_tour-Cookbook flows: login, table, modal, file picker, dashboard
showcase_tourcargo run --example showcase_tour-Showcase screens and dense layouts
canvas_tourcargo run --example canvas_tour-Canvas and raw drawing examples
text_tourcargo run --example text_tour-Text, CJK, pretext, and typography demos
system_tourcargo run --example system_tour --features asyncasyncAsync, inline, static, and system-level demos

Diagnostics And Development Tools

ExampleCommandFeaturesPurpose
debug_selectioncargo run --example debug_selection-Selection overlay debugging
demo_key_testcargo run --example demo_key_test-Inspect key events
test_mousecargo run --example test_mouse-Mouse interaction behavior
theme_hot_reloadcargo run --example theme_hot_reload --features theme-watchtheme-watchTheme file watcher demo

Performance And Reports

ExampleCommandFeaturesPurpose
perf_interactivecargo run --example perf_interactive-Interactive perf sanity checks
perf_regressioncargo run --example perf_regression-Headless perf regression coverage
v020_perf_auditcargo run --example v020_perf_audit-Non-interactive v0.20 perf report
v020_test_utilscargo run --example v020_test_utils-Non-interactive test utility report

Source-Only Demos

The remaining files in examples/ are kept as source modules for the tours. They intentionally do not have standalone [[example]] targets. Use the tour listed below instead of cargo run --example <source-file-name>.

Source demo familyRun this target
inline, async_demo, v020_static_log, error_boundary_democargo run --example system_tour --features async
anim, v020_* API demoscargo run --example v020_tour
cookbook_* demoscargo run --example cookbook_tour
demo_cli, demo_table, demo_website, demo_design_system, demo_pretextcargo run --example showcase_tour
demo_dashboard, demo_infoviz, demo_trading, demo_spreadsheet, demo_raw_drawcargo run --example showcase_tour
demo_kitty_image, demo_fire, demo_ime, demo_cjkcargo run --example text_tour
demo_game, demo_overlay_anchorcargo run --example showcase_tour

Suggested Path

  1. Start with hello.
  2. Move to counter.
  3. Open demo for breadth.
  4. Run the tour closest to your target app.
  5. Use docs/PATTERNS.md when you want composition guidance instead of a single demo.