pub struct Slider { /* private fields */ }Expand description
A slider: a number in a range, as the platform’s slider shows it, horizontal or vertical. Its label is its accessible name. What its step does is the platform’s: AppKit shows it as tick marks the knob stops at, WinUI and GTK snap the user’s moves to it, and Qt moves by it from the keyboard.
ⓘ
let volume = signal(50.0);
Slider::new("Volume").range(0.0, 100.0).step(10.0).bind(volume)Implementations§
Source§impl Slider
impl Slider
Sourcepub fn label(self, label: impl IntoValue<String>) -> Slider
pub fn label(self, label: impl IntoValue<String>) -> Slider
Its label: the accessible name, which new takes. In view!,
<Slider label="…"/>.
pub fn range(self, min: f64, max: f64) -> Slider
Sourcepub fn range_with(self, range: impl IntoValue<(f64, f64)>) -> Slider
pub fn range_with(self, range: impl IntoValue<(f64, f64)>) -> Slider
A range that changes: (min, max).
Sourcepub fn step(self, step: impl IntoValue<f64>) -> Slider
pub fn step(self, step: impl IntoValue<f64>) -> Slider
The step the platform snaps to (where its sliders snap) and moves by from the keyboard. Without one, the platform’s default.
pub fn value(self, value: impl IntoValue<f64>) -> Slider
pub fn enabled(self, enabled: impl IntoValue<bool>) -> Slider
Sourcepub fn orientation(self, orientation: impl IntoValue<Orientation>) -> Slider
pub fn orientation(self, orientation: impl IntoValue<Orientation>) -> Slider
Which way it runs; larger values are up when vertical.
Trait Implementations§
Source§impl ElementBuilder for Slider
impl ElementBuilder for Slider
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Escape hatch: edit the style directly (static).
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
Escape hatch: edit the style reactively.
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Alignment inside a grid cell along the inline axis.
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
Inset from the top of the containing block (with
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
Inset from the inline start (left in LTR, right in RTL).
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
Not laid out, not visible, not focusable, not in the a11y tree.
Un-hiding restores whatever
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
A tooltip: text the platform shows, its own way, when the pointer
rests on the widget, and assistive technology reads as its
description. Empty: none.
A context menu built by
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.A context menu built by
entries each time the platform opens it,
for a menu that depends on what’s selected or under the pointer at
that moment: a table row’s menu acting on the selection. What it
reads is read then, not followed.fn a11y_label(self, label: impl IntoValue<String>) -> Self
fn a11y_description(self, description: impl IntoValue<String>) -> Self
fn a11y_role(self, role: Role) -> Self
Source§fn on_focus(self, handler: impl Fn() + 'static) -> Self
fn on_focus(self, handler: impl Fn() + 'static) -> Self
Called when this control gains keyboard focus.
Source§fn on_blur(self, handler: impl Fn() + 'static) -> Self
fn on_blur(self, handler: impl Fn() + 'static) -> Self
Called when this control loses keyboard focus.
Source§fn tab_index(self, index: u32) -> Self
fn tab_index(self, index: u32) -> Self
Moves this control ahead in the Tab order. Controls with a tab index
come first (lowest first); the rest follow in reading order. Prefer
arranging the tree in the order users should visit it.
Auto Trait Implementations§
impl !RefUnwindSafe for Slider
impl !Send for Slider
impl !Sync for Slider
impl !UnwindSafe for Slider
impl Forget for Slider
impl Freeze for Sliderwhere
&'static str: Freeze,
*const u8 is !null: Freeze,
PhantomData<Track>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Prop>: Freeze,
PhantomData<Box<dyn FnOnce(&Ui, NodeId)>>: Freeze,
PhantomData<Rc<dyn Fn(&UiEvent)>>: Freeze,
PhantomData<AnyView>: Freeze,
*const RcInner<dyn Fn() -> (f64, f64)> is !null: Freeze,
PhantomData<RcInner<dyn Fn() -> (f64, f64)>>: Freeze,
*const RcInner<dyn Fn() -> f64> is !null: Freeze,
PhantomData<RcInner<dyn Fn() -> f64>>: Freeze,
impl Move for Slider
impl Unpin for Sliderwhere
&'static str: Unpin,
*const u8 is !null: Unpin,
Rc<dyn Fn() -> Vec<MenuEntry>>: Unpin,
Arc<[u8]>: Unpin,
Arc<Inner>: Unpin,
Rc<dyn DynValue>: Unpin,
Rc<Definition>: Unpin,
Rc<dyn Any>: Unpin,
Box<dyn FnOnce(&Ui, NodeId)>: Unpin,
Rc<dyn Fn(&UiEvent)>: Unpin,
Box<dyn FnOnce(&Ui) -> NodeId>: Unpin,
Rc<dyn Fn() -> (f64, f64)>: Unpin,
Rc<dyn Fn() -> f64>: Unpin,
impl UnsafeUnpin for Sliderwhere
&'static str: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Track>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Prop>: UnsafeUnpin,
PhantomData<Box<dyn FnOnce(&Ui, NodeId)>>: UnsafeUnpin,
PhantomData<Rc<dyn Fn(&UiEvent)>>: UnsafeUnpin,
PhantomData<AnyView>: UnsafeUnpin,
*const RcInner<dyn Fn() -> (f64, f64)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn() -> (f64, f64)>>: UnsafeUnpin,
*const RcInner<dyn Fn() -> f64> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn() -> f64>>: UnsafeUnpin,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more