1use gpui::{InteractiveElement, SharedString, Styled};
2
3pub trait VisibleOnHover {
4 /// Sets the element to only be visible when the specified group is hovered.
5 ///
6 /// Pass `""` as the `group_name` to use the global group.
7 fn visible_on_hover(self, group_name: impl Into<SharedString>) -> Self;
8}
9
10impl<E: InteractiveElement + Styled> VisibleOnHover for E {
11 fn visible_on_hover(self, group_name: impl Into<SharedString>) -> Self {
12 self.invisible()
13 .group_hover(group_name, |style| style.visible())
14 }
15}