Slider#
- class marimo.ui.slider(start: float, stop: float, step: float | None = None, value: float | None = None, debounce: bool = False, orientation: Literal['horizontal', 'vertical'] = 'horizontal', show_value: bool = False, *, label: str = '', on_change: Callable[[int | float | None], None] | None = None)#
A numeric slider over an interval.
Example.
slider = mo.ui.slider(start=1, stop=10, step=2)
Attributes.
value
: the current numeric value of the sliderstart
: the minimum value of the intervalstop
: the maximum value of the intervalstep
: the slider increment
Initialization Args.
start
: the minimum value of the intervalstop
: the maximum value of the intervalstep
: the slider incrementvalue
: default valuedebounce
: whether to debounce the slider to only send the value on mouse-up or drag-endorientation
: the orientation of the slider, either “horizontal” or “vertical”show_value
: whether to display the current value of the sliderlabel
: text label for the elementon_change
: optional callback to run when this element’s value changes
Public methods
Inherited from
UIElement
form
([label, bordered, loading, ...])Create a submittable form out of this
UIElement
.Inherited from
Html
batch
(**elements)Convert an HTML object with templated text into a UI element.
center
()Center an item.
right
()Right-justify.
left
()Left-justify.
callout
([kind])Create a callout containing this HTML element.
style
(style)Wrap an object in a styled container.
Public Data Attributes:
Inherited from
UIElement
value
The element’s current value.
Inherited from
Html
text
A string of HTML representing this element.