Skip to content
Development
Tutorial · Rust + WebAssembly

Build a task list

Start with a bare window and add state bindings, list editing, stylesheets, spring transitions, and local storage, then compile the same crate to the browser.

Chapters ​

  1. Open a window
    Mount a heading and two static rows inside a desktop window.
  2. Complete a task
    Tap a row so its checkmark and the header tally flip on the same frame.
  3. Add, remove, and filter
    Key rows by ModelItemId so filtering and deletion never scramble state.
  4. Reuse components and styles
    Extract a #[compose] filter button and dim completed rows via StyleSheetPlugin.
  5. Give the interface motion
    Tween the progress bar and let a spring-driven outline chase the active filter.
  6. Save and restore the list
    Attach PersistencePlugin so tasks survive across restarts.
  7. Run it in the browser
    Hand the exact same install function to WebCanvasSurface and test it at phone width.

Run on your machine ​

Install Rust and SDL2, check out the commit matching this manual, and launch chapter 7 natively:

sh
git clone https://github.com/W-Mai/mirui.git
cd mirui
git checkout 'd624dda55a1f97a3652a09dc7005c668e5e37549'
cargo run -p mirui-first-app --features desktop --example desktop -- 7