Skip to main content

Running Examples

The workspace includes a demo application and several example HTML pages.

Running the Demo

cargo run -p lui-demo

This launches a winit window with the default demo page. The demos live under demo/lui-demo/html/.

Running a Specific HTML File

cargo run -p lui-demo -- demo/lui-demo/html/styled-inputs.html

Demo Controls

KeyAction
EscExit the demo
F12Save a PNG screenshot
Ctrl+ASelect all text
Ctrl+CCopy selection to clipboard
F9Print profiler summary to stderr
Mouse wheelScroll viewport

Changing the Default Page

The default demo page is set in crates/lui-demo/src/main.rs via const DEFAULT_DOC. To change it permanently, edit that include:

const DEFAULT_DOC: &str = include_str!("../html/your-page.html");

Available Demo Pages

FileDescription
flex-browser-like.htmlFlex-based layout with navigation, content, and sidebar
grid.htmlHoly grail layout and photo gallery using CSS Grid
styled-inputs.htmlForm controls with various input types
overflow.htmlOverflow clipping demos (visible, hidden, rounded)
img-test.htmlImage loading and display
gif.htmlAnimated GIF rendering
table.htmlTable element parsing and styling

Screenshots

Press F12 to save screenshot-<unix>.png in the current working directory. For programmatic screenshots, see the Public API reference.

Profiling

Press F9 to dump a profiler summary to stderr showing cascade, layout, and paint timing per frame.