Skip to content

duanebester/gpui-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPUI List Examples

Example implementations of lists using GPUI.

Running Examples

# Run the simple list example (default)
cargo run

# Or explicitly:
cargo run --bin simple

# Run the global list example
cargo run --bin global

Examples

Simple List

The simple_list example has the model and list in one view. It demonstrates basic list state management with event emission to update the list when items are added.

Global List

The global_list example leverages a model in the global context. This demonstrates how sibling components can independently read from and react to shared state.

┌─────────────────────────────────┐
│           Workspace             │
├─────────────────────────────────┤
│  Header   │   List   │  Input   │  ← sibling components
│     ↓           ↓          ↓    │
│         GlobalStateModel        │  ← all subscribe independently
└─────────────────────────────────┘

Components:

  • Header - Subscribes to state changes and displays the total item count
  • List - Subscribes to state changes and rebuilds the list when items are added
  • Input - Triggers state updates via StateModel::update() / push()

All three components subscribe to AddListItemEvent independently, demonstrating a scalable architecture pattern where components react to global state changes without direct coupling to each other.

Common Components

The common ListItem component and shared utilities are in common.rs.

Screenshot

screenshot

About

Basic list examples in GPUI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages