NameLast commit messageLast commit date
..
imagegpui_web: Support Fetch requests from background workers (#61782)3 months ago
svgGPUI on the web (#50228)8 months ago
view_exampleUnify Render and RenderOnce into View (#58087)4 months ago
a11y.rsgpui: Fix web examples build (#59470)4 months ago
active_state_bug.rsFix sidebar selections (#50900)8 months ago
anchor.rsgpui: Improve Anchored to support center position (#47154)6 months ago
animation.rsGPUI on the web (#50228)8 months ago
data_table.rsGPUI on the web (#50228)8 months ago
drag_drop.rsGPUI on the web (#50228)8 months ago
focus_visible.rsGPUI on the web (#50228)8 months ago
gif_viewer.rsGPUI on the web (#50228)8 months ago
gradient.rsGPUI on the web (#50228)8 months ago
grid_layout.rsgpui: Add container_query element (#60774)4 months ago
hello_world.rsGPUI on the web (#50228)8 months ago
image_gallery.rsgpui_web: Support Fetch requests from background workers (#61782)3 months ago
image_loading.rsGPUI on the web (#50228)8 months ago
input.rsgpui: Implement audible system bell (#47531)7 months ago
layer_shell.rsGPUI on the web (#50228)8 months ago
list_example.rsgpui: Fix bottom-aligned scroll bar disappearing (#51223)7 months ago
mouse_pressure.rsGPUI on the web (#50228)8 months ago
move_entity_between_windows.rsQuery for window instead of capturing (#55059)6 months ago
on_window_close_quit.rszed: Add `track-project-leak` feature for easier leak debugging (#52172)7 months ago
opacity.rsgpui: Add builder API for BoxShadow (#57743)5 months ago
ownership_post.rsGPUI on the web (#50228)8 months ago
painting.rsgpui: Add `alpha` method to `Rgba` (#52125)5 months ago
paths_bench.rsGPUI on the web (#50228)8 months ago
pattern.rsGPUI on the web (#50228)8 months ago
popover.rsgpui: Improve Anchored to support center position (#47154)6 months ago
README.mdgpui: Add system notification platform APIs (#61189)3 months ago
scrollable.rsGPUI on the web (#50228)8 months ago
set_menus.rsgpui: Add `disabled` state to app menu items (#44191)7 months ago
shadow.rsgpui: Add builder API for BoxShadow (#57743)5 months ago
system_notifications.rsgpui: Add system notification platform APIs (#61189)3 months ago
tab_stop.rsGPUI on the web (#50228)8 months ago
testing.rsGPUI on the web (#50228)8 months ago
text.rsgpui: Add `disabled` state to app menu items (#44191)7 months ago
text_layout.rsGPUI on the web (#50228)8 months ago
text_wrapper.rsGPUI on the web (#50228)8 months ago
tree.rsGPUI on the web (#50228)8 months ago
uniform_list.rsGPUI on the web (#50228)8 months ago
window.rsChange "Ok" to "OK" in UI (#58744)5 months ago
window_movable.rsmacos: Fix window move controls are disabled (#60620)4 months ago
window_positioning.rsGPUI on the web (#50228)8 months ago
window_shadow.rsgpui: Add builder API for BoxShadow (#57743)5 months ago
README.md

GPUI Examples

Examples can be run from the Zed repository root:

cargo run -p gpui --example hello_world

Where to start

  • hello_world shows the basic shape of a GPUI application: create an Application, open a window, create a root view, and render a div.
  • input demonstrates text input, focus, selections, clipboard actions, and keyboard bindings.
  • uniform_list shows how to render a simple virtualized list.
  • testing demonstrates #[gpui::test], TestAppContext, actions, focus, and window-based tests.

Layout and styling

  • grid_layout demonstrates CSS-grid-style layout.
  • opacity demonstrates opacity styling.
  • pattern shows patterned backgrounds.
  • shadow demonstrates box shadows.
  • text shows styled text rendering.
  • text_layout demonstrates text alignment, decoration, weights, and wrapping.
  • text_wrapper shows wrapping text content.

Interaction

  • anchor demonstrates anchored positioning.
  • data_table combines virtualized list rendering with table-style rows and a custom scrollbar.
  • drag_drop shows draggable elements and drop targets.
  • focus_visible demonstrates keyboard-visible focus styling.
  • mouse_pressure demonstrates pressure-sensitive pointer input where supported.
  • popover shows floating layers with deferred and anchored.
  • scrollable demonstrates scrollable content.
  • tab_stop shows keyboard tab navigation.

Images, drawing, and animation

  • animation demonstrates GPUI animations and animated SVG transforms.
  • gif_viewer shows GIF rendering.
  • gradient demonstrates linear gradients and color spaces.
  • image shows local and remote image loading, image sizing, and asset setup.
  • image_gallery demonstrates image caching and loading remote images.
  • image_loading shows image loading states and asset loading.
  • painting demonstrates custom drawing with paths and canvas.
  • svg shows SVG rendering.

Windows and application behavior

  • move_entity_between_windows shows moving an entity between windows.
  • on_window_close_quit demonstrates quitting when a window closes.
  • set_menus shows application menu setup.
  • system_notifications demonstrates posting, replacing, dismissing, and responding to operating-system notifications.
  • window demonstrates creating normal, dialog, popup, and floating windows.
  • window_positioning demonstrates window bounds and placement.
  • window_shadow demonstrates window shadow styling.

Specialized examples

These examples are useful when working on GPUI itself, but they may not be the best starting point for new applications:

  • active_state_bug is a focused active-state reproduction.
  • layer_shell demonstrates Linux layer-shell windows.
  • list_example demonstrates bottom-aligned list state and scrollbar behavior.
  • ownership_post supports the ownership and data-flow documentation.
  • paths_bench is a path rendering benchmark.
  • tree renders a deep tree of nested elements.