Range Slider¶
- class marimo.ui.range_slider(start: int | float | None = None, stop: int | float | None = None, step: int | float | None = None, value: Sequence[int | float] | None = None, debounce: bool = False, orientation: Literal['horizontal', 'vertical'] = 'horizontal', show_value: bool = False, steps: Sequence[int | float] | None = None, *, label: str = '', on_change: Callable[[Sequence[int | float]], None] | None = None, full_width: bool = False)¶
A numeric slider for specifying a range over an interval.
Example.
range_slider = mo.ui.range_slider(start=1, stop=10, step=2, value=[2, 6])
Or from a dataframe series:
range_slider = mo.ui.range_slider.from_series(df["column_name"])
Or using numpy arrays:
import numpy as np steps = np.array([1, 2, 3, 4, 5]) # linear steps range_slider = mo.ui.range_slider(steps=steps) # log steps log_range_slider = mo.ui.range_slider(steps=np.logspace(0, 3, 4)) # power steps power_range_slider = mo.ui.range_slider(steps=np.power([1, 2, 3], 2))
Attributes.
value
: the current range value of the sliderstart
: the minimum value of the intervalstop
: the maximum value of the intervalstep
: the slider incrementsteps
: list of steps
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 slidersteps
: list of steps to customize the slider, mutually exclusive withstart
,stop
, andstep
label
: markdown label for the elementon_change
: optional callback to run when this element’s value changesfull_width
: whether the input should take up the full width of its container
Public methods
from_series
(series, **kwargs)Create a range slider from a dataframe series.
Inherited from
UIElement
form
([label, bordered, loading, ...])Create a submittable form out of this
UIElement
.send_message
(message, buffers)Send a message to the element rendered on the frontend from the backend.
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.
- static from_series(series: Any, **kwargs: Any) range_slider ¶
Create a range slider from a dataframe series.