pub struct ConnectedButtonGroup { /* private fields */ }Implementations§
Source§impl ConnectedButtonGroup
impl ConnectedButtonGroup
pub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
Sourcepub fn selection(self, selection: GroupSelection) -> Self
pub fn selection(self, selection: GroupSelection) -> Self
Single (default), multiple or no selection.
Sourcepub fn required(self, required: bool) -> Self
pub fn required(self, required: bool) -> Self
Whether a single selection must keep one option selected (default,
radio semantics). Optional selections are toggle buttons whose
changes arrive through on_toggle.
Sourcepub fn selected_values<V: Into<SharedString>>(
self,
values: impl IntoIterator<Item = V>,
) -> Self
pub fn selected_values<V: Into<SharedString>>( self, values: impl IntoIterator<Item = V>, ) -> Self
The selected values of a multiple or optional selection.
Sourcepub fn on_toggle(
self,
callback: impl Fn(&SharedString, bool, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_toggle( self, callback: impl Fn(&SharedString, bool, &mut Window, &mut App) + 'static, ) -> Self
The requested selection of one option of a toggle group (multiple, or an optional single selection).
Sourcepub fn on_activate(
self,
callback: impl Fn(&SharedString, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_activate( self, callback: impl Fn(&SharedString, &mut Window, &mut App) + 'static, ) -> Self
An activated option of a group without selection.
Sourcepub fn vertical(self, vertical: bool) -> Self
pub fn vertical(self, vertical: bool) -> Self
Stack the options vertically (connected top to bottom).
Sourcepub fn density(self, density: ButtonDensity) -> Self
pub fn density(self, density: ButtonDensity) -> Self
Shorten the options by the density’s step.
Sourcepub fn equal_widths(self, equal: bool) -> Self
pub fn equal_widths(self, equal: bool) -> Self
Give every option the widest one’s width (horizontal groups that fit their content; vertical options always share the column).
Sourcepub fn labels(self, labels: GroupLabels) -> Self
pub fn labels(self, labels: GroupLabels) -> Self
When options with icons show their labels.
Sourcepub fn variant(self, variant: ButtonVariant) -> Self
pub fn variant(self, variant: ButtonVariant) -> Self
The toggle-button colors the options use: tonal by default (the kit’s connected group), or filled, elevated or outlined.
An M3 Expressive button size (XS–XL): the options take that button’s height, padding, label type and icon, and the size’s inner corners. Without it the group keeps its compact 40px default.
Sourcepub fn shape(self, shape: ButtonShape) -> Self
pub fn shape(self, shape: ButtonShape) -> Self
Round (default) or square ends: square ends of unselected options take the inner corner radius. The selected option is a full pill.
Sourcepub fn options<K: Into<SharedString>, V: Into<SharedString>>(
self,
options: impl IntoIterator<Item = (K, V)>,
) -> Self
pub fn options<K: Into<SharedString>, V: Into<SharedString>>( self, options: impl IntoIterator<Item = (K, V)>, ) -> Self
The options as (value, label) pairs. Values identify an option’s
focus and selection state, so they must be unique: a repeated value
is a caller bug (a debug assertion), and release builds keep only its
first occurrence.
pub fn selected(self, value: impl Into<SharedString>) -> Self
Sourcepub fn full_width(self) -> Self
pub fn full_width(self) -> Self
Fill the parent’s width in equal options, each at least as wide as its label; options wrap to another row only when their labels cannot fit.
Sourcepub fn segmented(self) -> Self
pub fn segmented(self) -> Self
Connected segments that fill the parent, with persistent option icons. Radio/tab semantics, focus navigation and pointer feedback are unchanged.
Sourcepub fn height(self, height: Rems) -> Self
pub fn height(self, height: Rems) -> Self
Override option text for a page-specific typography role. Override the option height (48px segmented, 40px otherwise), e.g. for a page’s view tabs.
pub fn label_text_size(self, size: Rems) -> Self
Sourcepub fn tabs(self) -> Self
pub fn tabs(self) -> Self
Navigation uses the same surfaces, with tab semantics and optional leading layout.
pub fn focus_handles( self, handles: impl IntoIterator<Item = FocusHandle>, ) -> Self
Sourcepub fn icon(self, value: impl Into<SharedString>, icon: impl Into<Icon>) -> Self
pub fn icon(self, value: impl Into<SharedString>, icon: impl Into<Icon>) -> Self
Attach an icon by option value; this may be called before or after options.
pub fn reveal_in(self, scroll: ScrollHandle) -> Self
pub fn disabled(self, disabled: bool) -> Self
Sourcepub fn preview_state(
self,
value: impl Into<SharedString>,
state: InteractionPreview,
) -> Self
pub fn preview_state( self, value: impl Into<SharedString>, state: InteractionPreview, ) -> Self
Render the option with value as a static specimen in one forced
interaction state, painting what that live state paints (its hover or
press layer, focus ring or disabled colors). A group with any preview
is a specimen: it leaves the tab order, and its other options ignore
live hover and press. See InteractionPreview.
pub fn on_change( self, callback: impl Fn(&SharedString, &mut Window, &mut App) + 'static, ) -> Self
Trait Implementations§
Source§impl IntoElement for ConnectedButtonGroup
impl IntoElement for ConnectedButtonGroup
Source§type Element = ViewElement<ConnectedButtonGroup>
type Element = ViewElement<ConnectedButtonGroup>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Auto Trait Implementations§
impl !RefUnwindSafe for ConnectedButtonGroup
impl !Send for ConnectedButtonGroup
impl !Sync for ConnectedButtonGroup
impl !UnwindSafe for ConnectedButtonGroup
impl Freeze for ConnectedButtonGroup
impl Unpin for ConnectedButtonGroup
impl UnsafeUnpin for ConnectedButtonGroup
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§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,
§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,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§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,
§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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.