Skip to main content

Module examples

Module examples 

Source
Expand description

§Examples

Each page contains a complete program for one area of GPUI. Many also run in the browser on the GPUI site. Examples that require desktop platform services, such as notifications, run locally.

To run one yourself, clone the repository and run it by name:

git clone https://github.com/gpui-ce/gpui-ce
cd gpui-ce
cargo run --example counter

Start with hello_world to see how an application opens a window, then counter for state and click handlers. The tutorial combines these ideas into todos, adding text input, components, background work, and tests.

Modules§

animation
Animations, easing, springs and style transitions.
canvas
A chart drawn with canvas and PathBuilder.
counter
A click counter connecting entity state, an event handler, and notify.
custom_element
A slider written as a custom Element.
events
Entities that observe each other and communicate with events.
haptics
Haptic feedback on trackpads that support it.
hello_world
The smallest GPUI program: a window with a styled greeting.
images
Raster and vector images, and how they fit their boxes.
interaction
Hover, press, clicks, cursors, tooltips, and drag and drop.
keyboard
Actions, key bindings, key contexts, and focus navigation.
keyring
Storing credentials in the platform keychain.
layer_shell
Wayland layer-shell surfaces, such as panels and overlays.
layout
An application shell built with flexbox and grid.
list
A virtualized list of ten thousand rows with keyboard selection.
notifications
Sending system notifications.
styling
Backgrounds, borders, corners, shadows, opacity and blur.
tasks
A stopwatch and a cancellable background job.
text
Font sizes, weights, decoration, wrapping, truncation, and styled runs.
text_input
Single- and multi-line editable text.
todos
The finished app from the tutorial.
windows
Opening, placing and closing several windows.