zed/crates/gpui/examples
Cameron Mcloughlin 1d029c5ff5
gpui: Accesskit support (#56065)
GPUI AccessKit integration

This PR is replacing #51097 , and is much more limited in scope. This PR
*ONLY* adds AccessKit support to GPUI, and doesn't touch Zed. Once this
lands, we can start adding aria attributes to Zed's components.

This PR is the first step to addressing #41138 .

Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: John Tur <john-tur@outlook.com>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Agus Zubiaga <agus@zed.dev>
2026-05-27 18:17:59 +00:00
..
image gpui: Add disabled state to app menu items (#44191) 2026-03-20 11:00:00 +00:00
svg GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
a11y.rs gpui: Accesskit support (#56065) 2026-05-27 18:17:59 +00:00
active_state_bug.rs Fix sidebar selections (#50900) 2026-03-06 06:51:26 +00:00
anchor.rs gpui: Improve Anchored to support center position (#47154) 2026-04-21 09:01:42 +00:00
animation.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
data_table.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
drag_drop.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
focus_visible.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
gif_viewer.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
gradient.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
grid_layout.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
hello_world.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
image_gallery.rs gpui: Add disabled state to app menu items (#44191) 2026-03-20 11:00:00 +00:00
image_loading.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
input.rs gpui: Implement audible system bell (#47531) 2026-04-01 02:50:01 +00:00
layer_shell.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
list_example.rs gpui: Fix bottom-aligned scroll bar disappearing (#51223) 2026-03-25 22:29:40 +00:00
mouse_pressure.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
move_entity_between_windows.rs Query for window instead of capturing (#55059) 2026-04-28 08:04:42 +00:00
on_window_close_quit.rs zed: Add track-project-leak feature for easier leak debugging (#52172) 2026-03-25 09:15:29 +00:00
opacity.rs gpui: Add support for inset shadow (#57685) 2026-05-26 14:32:45 +00:00
ownership_post.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
painting.rs zed: Add track-project-leak feature for easier leak debugging (#52172) 2026-03-25 09:15:29 +00:00
paths_bench.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
pattern.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
popover.rs gpui: Improve Anchored to support center position (#47154) 2026-04-21 09:01:42 +00:00
README.md gpui: Add examples index (#55154) 2026-04-29 12:36:29 +00:00
scrollable.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
set_menus.rs gpui: Add disabled state to app menu items (#44191) 2026-03-20 11:00:00 +00:00
shadow.rs gpui: Add support for inset shadow (#57685) 2026-05-26 14:32:45 +00:00
tab_stop.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
testing.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
text.rs gpui: Add disabled state to app menu items (#44191) 2026-03-20 11:00:00 +00:00
text_layout.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
text_wrapper.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
tree.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
uniform_list.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
window.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
window_positioning.rs GPUI on the web (#50228) 2026-02-26 18:36:50 +01:00
window_shadow.rs gpui: Add support for inset shadow (#57685) 2026-05-26 14:32:45 +00:00

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.
  • 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.