gpui-component/assets/icons
Jason Lee 9a040eaaac
list: Refactor List, Dropdown delegate API to support section. (#1107)
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>
2025-08-05 19:23:32 +08:00
..
a-large-small.svg chore: Add base ui attributes to Root and add change font size to story to test font adjust. (#409) 2024-11-12 11:17:16 +08:00
arrow-down.svg table: Add sort button to table column. (#77) 2024-07-28 23:24:55 +08:00
arrow-left.svg Add WebView (#2) 2024-07-18 18:00:23 +08:00
arrow-right.svg Add WebView (#2) 2024-07-18 18:00:23 +08:00
arrow-up.svg table: Add sort button to table column. (#77) 2024-07-28 23:24:55 +08:00
asterisk.svg Improve OtpInput to add more size, use Icon to render mask. (#116) 2024-08-07 11:39:02 +08:00
bell.svg Update Root API (#150) 2024-08-15 17:27:34 +08:00
book-open.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
bot.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
building-2.svg avatar: Add Avatar element. (#1028) 2025-07-02 18:58:06 +08:00
calendar.svg Add Calendar and DatePicker. (#117) 2024-08-07 20:25:11 +08:00
chart-pie.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
check.svg Add checkbox, title_bar. 2024-06-25 17:16:04 +08:00
chevron-down.svg Add Dropdown. 2024-06-28 10:11:00 +08:00
chevron-left.svg Add WebView (#2) 2024-07-18 18:00:23 +08:00
chevron-right.svg Add WebView (#2) 2024-07-18 18:00:23 +08:00
chevron-up.svg table: Add sort button to table column. (#77) 2024-07-28 23:24:55 +08:00
chevrons-up-down.svg Update Dropdown icon to ChevronsUpDown 2024-06-28 10:19:24 +08:00
circle-check.svg Add Notification (#149) 2024-08-15 16:50:33 +08:00
circle-user.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
circle-x.svg Add Icon Button support. (#11) 2024-07-01 21:32:03 +08:00
close.svg Update Dropdown title to use SharedString (#95) 2024-08-01 11:00:18 +08:00
copy.svg Add clipboard (#105) 2024-08-05 11:35:02 +08:00
dash.svg Add checkbox, title_bar. 2024-06-25 17:16:04 +08:00
delete.svg icon: Fix broken assets delete.svg (#340) 2024-10-14 22:07:18 +08:00
ellipsis-vertical.svg Add a List example (#8) 2024-06-30 16:56:23 +08:00
ellipsis.svg Add a List example (#8) 2024-06-30 16:56:23 +08:00
external-link.svg menu: Add external link icon to link menu item. (#734) 2025-03-24 22:30:29 +08:00
eye-off.svg Add to masked Label and support children to Button (#50) 2024-07-19 18:54:16 +08:00
eye.svg Add to masked Label and support children to Button (#50) 2024-07-19 18:54:16 +08:00
folder-closed.svg list: Refactor List, Dropdown delegate API to support section. (#1107) 2025-08-05 19:23:32 +08:00
folder-open.svg list: Refactor List, Dropdown delegate API to support section. (#1107) 2025-08-05 19:23:32 +08:00
folder.svg list: Refactor List, Dropdown delegate API to support section. (#1107) 2025-08-05 19:23:32 +08:00
frame.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
gallery-vertical-end.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
github.svg button: Fix Button click prevent_default. (#84) 2024-07-30 00:28:18 +08:00
globe.svg Add Calendar and DatePicker. (#117) 2024-08-07 20:25:11 +08:00
heart-off.svg Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
heart.svg Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
inbox.svg Improved Input prefix, suffix with a builder to support Element. (#54) 2024-07-22 15:30:07 +08:00
info.svg Add a List example (#8) 2024-06-30 16:56:23 +08:00
inspector.svg inspector: Add Inspector. (#897) 2025-05-26 16:44:11 +08:00
layout-dashboard.svg dock: Add add_panel method to add panel to DockArea. (#440) 2024-11-27 11:27:04 +08:00
loader-circle.svg Add Indicator (#25) 2024-07-12 17:33:05 +08:00
loader.svg Add Indicator (#25) 2024-07-12 17:33:05 +08:00
map.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
maximize.svg Add checkbox, title_bar. 2024-06-25 17:16:04 +08:00
menu.svg Add Link style Button (#97) 2024-08-01 19:54:35 +08:00
minimize.svg Add checkbox, title_bar. 2024-06-25 17:16:04 +08:00
minus.svg Add checkbox, title_bar. 2024-06-25 17:16:04 +08:00
moon.svg button: Fix Button click prevent_default. (#84) 2024-07-30 00:28:18 +08:00
palette.svg Add ColorPicker (#199) 2024-09-02 00:21:01 +08:00
panel-bottom-open.svg dock: Add left, bottom, right fixed dock and support toggle. (#291) 2024-10-02 17:42:52 +08:00
panel-bottom.svg dock: Add left, bottom, right fixed dock and support toggle. (#291) 2024-10-02 17:42:52 +08:00
panel-left-close.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
panel-left-open.svg dock: Add left, bottom, right fixed dock and support toggle. (#291) 2024-10-02 17:42:52 +08:00
panel-left.svg dock: Add left, bottom, right fixed dock and support toggle. (#291) 2024-10-02 17:42:52 +08:00
panel-right-close.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
panel-right-open.svg dock: Add left, bottom, right fixed dock and support toggle. (#291) 2024-10-02 17:42:52 +08:00
panel-right.svg dock: Add left, bottom, right fixed dock and support toggle. (#291) 2024-10-02 17:42:52 +08:00
plus.svg Add a List example (#8) 2024-06-30 16:56:23 +08:00
resize-corner.svg tiles: Add Tiles (#435) 2024-12-16 20:33:14 +08:00
search.svg Add SvgImg to render svg, and with a Chart example (#13) 2024-07-03 19:09:59 +08:00
settings-2.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
settings.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
sort-ascending.svg table: Improve sort icon color and fix stripe row display. (#578) 2025-01-26 16:25:34 +08:00
sort-descending.svg table: Improve sort icon color and fix stripe row display. (#578) 2025-01-26 16:25:34 +08:00
square-terminal.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
star-off.svg Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
star.svg Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
sun.svg button: Fix Button click prevent_default. (#84) 2024-07-30 00:28:18 +08:00
thumbs-down.svg Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
thumbs-up.svg Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
triangle-alert.svg Add Notification (#149) 2024-08-15 16:50:33 +08:00
user.svg avatar: Add Avatar element. (#1028) 2025-07-02 18:58:06 +08:00
window-close.svg title_bar: Add a new TitleBar, remove the old version. (#348) 2024-10-16 16:22:17 +08:00
window-maximize.svg title_bar: Add a new TitleBar, remove the old version. (#348) 2024-10-16 16:22:17 +08:00
window-minimize.svg title_bar: Add a new TitleBar, remove the old version. (#348) 2024-10-16 16:22:17 +08:00
window-restore.svg title_bar: Add a new TitleBar, remove the old version. (#348) 2024-10-16 16:22:17 +08:00