mo.ui.slider
Create a numeric slider for selecting values from a range.
Signature
mo.ui.slider(
start: Numeric | None = None,
stop: Numeric | None = None,
step: Numeric | None = None,
value: Numeric | None = None,
debounce: bool = False,
*,
label: str = "",
on_change: Callable[[Numeric], None] | None = None,
disabled: bool = False,
orientation: Literal["horizontal", "vertical"] = "horizontal",
show_value: bool = False,
include_input: bool = False,
steps: Sequence[Numeric] | None = None,
full_width: bool = False
)
Parameters
Minimum value of the slider range
Maximum value of the slider range
Initial value (defaults to start)
Only send value on mouse-up/drag-end
Markdown label for the slider
Whether the slider is disabled
orientation
'horizontal' | 'vertical'
default:"'horizontal'"
Slider orientation
Show editable input field
Custom step values (mutually exclusive with start/stop/step)
Examples
import marimo as mo
# Basic slider
slider = mo.ui.slider(start=0, stop=100, step=1)
slider
# Slider with value display
slider = mo.ui.slider(
start=0,
stop=10,
step=0.1,
value=5,
label="**Temperature**",
show_value=True
)
# Custom steps (logarithmic scale)
import numpy as np
log_slider = mo.ui.slider(
steps=np.logspace(0, 3, 10),
label="Log scale"
)
Creating from DataFrame
slider = mo.ui.slider.from_series(df["age"])