Provides user selection from a range of values. The
The slider can be controlled by a single value or a range of values. Slider can be hooked to state to control its value. Passing a list of two values creates a range slider.
50
Range slider is created by passing a list of two values to the default_value
prop. The list should contain two values that are in the range of the slider.
25
75
You can use the on_change
prop to update the slider value as you interact with it. The on_change
prop takes a function that will be called with the new value of the slider.
Here we use the throttle
method to limit the rate at which the function is called, which is useful to prevent excessive updates. In this example, the slider value is updated every 100ms.
50
Here we show how to use a slider in a form. We use the name
prop to identify the slider in the form data. The form data is then passed to the handle_submit
method to be processed.