pub struct Collapsible { /* private fields */ }Expand description
Material 3 single expandable/collapsible container wrapping gpui_base::Collapsible.
The application owns the open state and applies requests reported through
Self::on_open_change.
Implementations§
Source§impl Collapsible
impl Collapsible
Sourcepub fn new(
id: impl Into<ElementId>,
title: impl Into<SharedString>,
open: bool,
) -> Collapsible
pub fn new( id: impl Into<ElementId>, title: impl Into<SharedString>, open: bool, ) -> Collapsible
Creates a controlled Material 3 collapsible container with stable id, accessible
title, and current open state.
Sourcepub fn supporting(self, text: impl Into<SharedString>) -> Collapsible
pub fn supporting(self, text: impl Into<SharedString>) -> Collapsible
Sets optional supporting text displayed beneath the header title.
Sourcepub fn leading(self, element: impl IntoElement) -> Collapsible
pub fn leading(self, element: impl IntoElement) -> Collapsible
Places a decorative leading icon or element at the logical start of the header.
Sourcepub fn trailing(self, element: impl IntoElement) -> Collapsible
pub fn trailing(self, element: impl IntoElement) -> Collapsible
Places a decorative trailing element before the disclosure chevron.
Sourcepub fn header_content(self, element: impl IntoElement) -> Collapsible
pub fn header_content(self, element: impl IntoElement) -> Collapsible
Replaces the visible header title/supporting block while retaining the constructor
title as the accessible button name.
Sourcepub fn indicator(self, element: impl IntoElement) -> Collapsible
pub fn indicator(self, element: impl IntoElement) -> Collapsible
Replaces the default rotating disclosure chevron with custom decorative content.
Sourcepub fn show_indicator(self, show: bool) -> Collapsible
pub fn show_indicator(self, show: bool) -> Collapsible
Shows or hides the trailing disclosure indicator (defaults to true).
Sourcepub fn content(self, element: impl IntoElement) -> Collapsible
pub fn content(self, element: impl IntoElement) -> Collapsible
Sets the collapsible body content displayed when expanded.
Sourcepub fn keep_mounted(self, keep_mounted: bool) -> Collapsible
pub fn keep_mounted(self, keep_mounted: bool) -> Collapsible
Keeps the collapsible body mounted at zero height while collapsed.
Sourcepub fn disabled(self, disabled: bool) -> Collapsible
pub fn disabled(self, disabled: bool) -> Collapsible
Disables user toggling, skips keyboard focus, and applies disabled styling.
Sourcepub fn bordered(self, bordered: bool) -> Collapsible
pub fn bordered(self, bordered: bool) -> Collapsible
Draws a 1 px OutlineVariant perimeter border (defaults to true).
Sourcepub fn divider(self, divider: bool) -> Collapsible
pub fn divider(self, divider: bool) -> Collapsible
Draws a horizontal divider between the header and expanded body (defaults to true).
Sourcepub fn shape(self, shape: CornerShape) -> Collapsible
pub fn shape(self, shape: CornerShape) -> Collapsible
Overrides the container corner shape (defaults to CornerRole::Medium).
Sourcepub fn colors(self, colors: CollapsibleColors) -> Collapsible
pub fn colors(self, colors: CollapsibleColors) -> Collapsible
Overrides individual container, text, icon, border, and divider colors.
Sourcepub fn content_padding(self, padding: LogicalEdges) -> Collapsible
pub fn content_padding(self, padding: LogicalEdges) -> Collapsible
Sets logical inner padding for the expanded content region (defaults to 16 dp on all sides).
Sourcepub fn track_focus(self, focus: &FocusHandle) -> Collapsible
pub fn track_focus(self, focus: &FocusHandle) -> Collapsible
Attaches a caller-owned FocusHandle to the collapsible header trigger.
Sourcepub fn interaction_source(
self,
source: &Entity<InteractionSource>,
) -> Collapsible
pub fn interaction_source( self, source: &Entity<InteractionSource>, ) -> Collapsible
Observes trigger hover, press, keyboard focus, and disabled state in source.
Sourcepub fn on_open_change(
self,
handler: impl Fn(bool, &mut Window, &mut App) + 'static,
) -> Collapsible
pub fn on_open_change( self, handler: impl Fn(bool, &mut Window, &mut App) + 'static, ) -> Collapsible
Handles a user request to toggle the controlled open state.
Trait Implementations§
Source§impl IntoElement for Collapsible
impl IntoElement for Collapsible
Source§type Element = ViewElement<Collapsible>
type Element = ViewElement<Collapsible>
Source§fn into_element(self) -> <Collapsible as IntoElement>::Element
fn into_element(self) -> <Collapsible as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for Collapsible
impl RenderOnce for Collapsible
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for Collapsible
impl !Send for Collapsible
impl !Sync for Collapsible
impl !UnwindSafe for Collapsible
impl Forget for Collapsible
impl Freeze for Collapsiblewhere
NonZero<u32>: Freeze,
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const ArcInner<Path> is !null: Freeze,
PhantomData<ArcInner<Path>>: Freeze,
*const str is !null: Freeze,
PhantomData<&'static str>: Freeze,
*const ArcInner<ElementId> is !null: Freeze,
PhantomData<ArcInner<ElementId>>: Freeze,
*mut dyn ElementObject: Freeze,
*const RcInner<Cell<bool>> is !null: Freeze,
PhantomData<RcInner<Cell<bool>>>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(InteractionSource) -> InteractionSource>: Freeze,
*const RcInner<dyn Fn(bool, &mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(bool, &mut Window, &mut App)>>: Freeze,
impl Move for Collapsible
impl Unpin for Collapsiblewhere
NonZero<u32>: Unpin,
&'static str: Unpin,
Arc<str>: Unpin,
Arc<Path>: Unpin,
*const str is !null: Unpin,
Arc<ElementId>: Unpin,
*mut dyn ElementObject: Unpin,
Rc<Cell<bool>>: Unpin,
Arc<RwLock<RawRwLock, FocusMap>>: Unpin,
*const (): Unpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Unpin,
Rc<dyn Fn(bool, &mut Window, &mut App)>: Unpin,
impl UnsafeUnpin for Collapsiblewhere
NonZeroU32Inner: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const ArcInner<Path> is !null: UnsafeUnpin,
PhantomData<ArcInner<Path>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<&'static str>: UnsafeUnpin,
*const ArcInner<ElementId> is !null: UnsafeUnpin,
PhantomData<ArcInner<ElementId>>: UnsafeUnpin,
*mut dyn ElementObject: UnsafeUnpin,
*const RcInner<Cell<bool>> is !null: UnsafeUnpin,
PhantomData<RcInner<Cell<bool>>>: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(InteractionSource) -> InteractionSource>: UnsafeUnpin,
*const RcInner<dyn Fn(bool, &mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(bool, &mut Window, &mut App)>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(
self,
text: impl Into<SharedString>,
) -> ObservedText<Self::Element>
fn test_alt_text( self, text: impl Into<SharedString>, ) -> ObservedText<Self::Element>
Self::test_text for an image’s alternative text, which
stands in for what the element draws.