gpui-component/crates
Jason Lee 2dbfba3490
popover: Improve Popover API. (#1545)
- Add `open`, `on_open_change` method to control open state.
- Add `default_open` method.

## Break Change

This PR to rewrite the API of Popover API to make it easy to use. 

- The `content` method now can receive an element directly.

```diff
- .content(|window, cx| {
-     cx.new(|cx| {
-         PopoverContent::new(window, cx, |_, _| {
-             div().child("This popover content.")
-         })
-     })
- })
+ .content(|state, window, cx| {
+     div().child("This popover content.")
+ })
```

- And you can also just use `child` and `children` to add child
elements.

```rs
Popover::new("my-popover")
    .trigger(Button::new("trigger").label("Open Popover"))
    .child("This popover content.")
```

- Removed `PopoverContent`, and changed `Popover` default paddings to
`p_3`.
2025-11-11 17:45:30 +08:00
..
macros Bump v0.4.0-preview1. 2025-11-06 22:27:26 +08:00
reqwest_client Bump v0.4.0-preview1. 2025-11-06 22:27:26 +08:00
story popover: Improve Popover API. (#1545) 2025-11-11 17:45:30 +08:00
ui popover: Improve Popover API. (#1545) 2025-11-11 17:45:30 +08:00