Skip to main content

Examples Overview

Iced provides 50+ examples demonstrating different GUI patterns, widgets, and features. All examples are available in the GitHub repository.
These examples are compatible with the master branch. For examples compatible with the latest release, switch to the latest branch.

Tour

A comprehensive UI tour that runs on both native platforms and the web. Showcases different widgets available in Iced. Run with:
cargo run --package tour

Todos

A full-featured todo tracker inspired by TodoMVC. Demonstrates:
  • Dynamic layout
  • Text input and validation
  • Checkboxes and scrollables
  • Icons and custom fonts
  • Async actions and background saving
  • State persistence (localStorage on web, filesystem on native)
Run with:
cargo run --package todos

Game of Life

An interactive version of Conway’s Game of Life featuring:
  • Background thread simulation
  • Canvas with infinite grid
  • Zooming and panning
  • Drawing support
Run with:
cargo run --package game_of_life

Styling

Demonstrates custom styling with light and dark themes, showcasing how to apply themes to various widgets. Run with:
cargo run --package styling

Complete Example List

All examples can be run using:
cargo run --package <example-name>

Basic Examples

ExampleDescription
counterClassic counter with increment/decrement buttons
eventsLog of native events using conditional subscriptions
exitDemonstrates graceful application exit
textText rendering and formatting
layoutLayout system demonstration

Widget Examples

ExampleDescription
buttonButton widget with various styles
checkboxCheckbox widget demonstration
pick_listDropdown list of selectable options
sliderSlider widget for value selection
text_inputText input and editing
togglerToggle switch widget
tooltipTooltips for enhanced UX
combo_boxCombo box with autocomplete
progress_barProgress bar with slider control
scrollableVarious scrollable content configurations

Canvas & Graphics

ExampleDescription
bezier_toolPaint-like tool for drawing Bézier curves
clockAnalog clock using Canvas
geometryCustom widget with Mesh2D primitive
custom_widgetBuilding a custom circular widget
custom_quadCustom quad rendering
custom_shaderCustom shader implementation
gradientGradient rendering
sierpinski_triangleSierpiński triangle using Canvas and Slider
solar_systemAnimated solar system with transforms
svgRendering SVG graphics (Ghostscript Tiger)

Advanced Examples

ExampleDescription
pane_gridGrid of panes that can be split and resized
modalModal dialog implementation
multi_windowMultiple window management
integrationIntegrating Iced into existing wgpu apps
editorText editor implementation
markdownMarkdown rendering
tableTable widget demonstration

Async & Network

ExampleDescription
download_progressAsync file download with progress tracking
pokedexFetching data from PokéAPI
websocketWebSocket communication

Visual Effects

ExampleDescription
color_paletteColor palette generator
loading_spinnersVarious loading spinner styles
toastToast notification system
loupeMagnifying glass effect
screenshotTaking screenshots
the_matrixMatrix-style animation
sandpilesSandpile simulation

Multimedia & Platform

ExampleDescription
qr_codeQR code generation and display
ferrisFerris the crab mascot
galleryImage gallery
system_informationDisplay system information
url_handlerURL handling and navigation
multitouchMulti-touch gesture support
vectorial_textVector text rendering

Other Examples

ExampleDescription
stopwatchStopwatch with start/stop/reset buttons
lazyLazy widget demonstration
delineateWidget boundary visualization
changelogApplication changelog viewer
arcArc drawing demonstration

Example Structure

Most examples follow a consistent structure:
  1. State - Application state structure
  2. Messages - Events that can occur
  3. Update logic - How state changes in response to messages
  4. View logic - How to render the UI based on state
  5. Optional subscriptions - For time-based or external events

Learning Path

Recommended order for learning:
  1. Start with counter - Learn basic structure
  2. Try styling - Understand themes and visual customization
  3. Explore todos - See a complete application
  4. Build custom widgets with custom_widget
  5. Dive into canvas examples for custom graphics
  6. Study pane_grid and modal for complex layouts

Running Examples

Native

cd examples/<example-name>
cargo run

Web (for compatible examples)

trunk serve --open

Source Code

All examples include complete, working source code. The main logic is typically in src/main.rs, demonstrating Iced’s architecture principles:
  • Pure functions for updates and views
  • Immutable state transformations
  • Type-safe message handling
  • Declarative UI composition
Explore the examples directory on GitHub for complete implementations.

Build docs developers (and LLMs) love