Ref UITableView API: https://developer.apple.com/documentation/uikit/uitableviewdatasource ## Changes - Added some section related API to `ListDelegeate` and `DropdownDelegate` with default implement, so if you don't need section that you can just keep the default. - Added `sections_count` method to get the number of sections, default is 1. - Added `render_section_header` for special the section header by if needed, default return None. - Added `render_section_footer` for special the section footer by if needed, default return None. ## Break Changes - The `DropdownState` have change new method to use IndexPath type: ```diff - DropdownState::new(vec![], Some(1), window, cx); + DropdownState::new(vec![], Some(IndexPath::new(1)), window, cx); ``` - The `ListDelegeate`, `DropdownDelegate` has changed API: - The `ix` are change from `usize` to `IndexPath`. ```diff - fn render_item(&self, ix: usize, window: &mut Window, cx: &mut Context<List<Self>>) -> Option<Self::Item> + fn render_item(&self, ix: IndexPath, window: &mut Window, cx: &mut Context<List<Self>>) -> Option<Self::Item> - fn set_selected_index(&mut self, ix: Option<usize>, window: &mut Window, cx: &mut Context<List<Self>>) + fn set_selected_index(&mut self, ix: Option<IndexPath>, window: &mut Window, cx: &mut Context<List<Self>>) ``` - The `items_count` method have added `section` argument to support list section. ```diff - fn items_count(&self, cx: &App) -> usize + fn items_count(&self, section: usize, cx: &App) -> usize ``` - The `can_load_more` method has renamed to `is_eof` in `ListDelegate` and `TableDelegate`. ```diff - fn can_load_more(&self, cx: &App) -> bool + fn is_eof(&self, cx: &App) -> bool ``` - The `can_search` method has renamed to `searchable` in `ListDelegate`. ```diff - fn can_search(&self) -> bool + fn searchable(&self) -> bool ``` ## Showcase <img width="1196" height="925" alt="image" src="https://github.com/user-attachments/assets/22750abe-cc3f-427e-903b-51758bd4e027" /> <img width="1214" height="934" alt="image" src="https://github.com/user-attachments/assets/52d42546-e6e7-4448-9c0f-43cd659fb630" /> --------- Co-authored-by: Floyd Wang <gassnake999@gmail.com> |
||
|---|---|---|
| .cargo | ||
| .github | ||
| assets | ||
| crates | ||
| script | ||
| themes | ||
| .gitignore | ||
| .theme-schema.json | ||
| Cargo.lock | ||
| Cargo.toml | ||
| DEVELOPMENT.md | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE-APACHE | ||
| README.md | ||
GPUI Component
UI components for building fantastic desktop applications using GPUI.
Features
- Richness: 40+ cross-platform desktop UI components.
- Native: Inspired by macOS and Windows controls, combined with shadcn/ui design for a modern experience.
- Ease of Use: Stateless
RenderOncecomponents, simple and user-friendly. - Customizable: Built-in
ThemeandThemeColor, supporting multi-theme and variable-based configurations. - Versatile: Supports sizes like
xs,sm,md, andlg. - Flexible Layout: Dock layout for panel arrangements, resizing, and freeform (Tiles) layouts.
- High Performance: Virtualized Table and List components for smooth large-data rendering.
- Content Rendering: Native support for Markdown and simple HTML.
- Charting: Built-in charts for visualization your data.
- Code Highlighting: Code Editor and Syntax highlighting.
- Wef: (Experimental) Offscreen rendering webview based on CEF.
Showcase
Here is the first application: Longbridge Pro, built using GPUI Component.
We built multi-theme support in the application. This feature is not included in GPUI Component itself, but is based on the Theme feature, so it's easy to implement.
Usage
GPUI and GPUI Component are still in development, so you need to add dependencies by git.
gpui = { git = "https://github.com/zed-industries/zed.git" }
gpui-component = { git = "https://github.com/longbridge/gpui-component.git" }
WebView
Still early and experimental; there are a lot of limitations.
GPUI Component has a WebView element based on Wry. This is an optional feature, which you can enable with a feature flag.
gpui-component = { git = "https://github.com/longbridge/gpui-component.git", features = ["webview"] }
More usage examples can be found in the story directory.
Icons
GPUI Component has an Icon element, but it does not include SVG files by default.
The example uses Lucide icons, but you can use any icons you like. Just name the SVG files as defined in IconName. You can add any icons you need to your project.
Development
We have a gallery of applications built with GPUI Component.
cargo run
More examples can be found in the examples directory. You can run them with cargo run --example <example_name>.
Check out DEVELOPMENT.md for more details.
License
Apache-2.0