Module slider

Source
Expand description

A reusable, interactive slider UI component for selecting a value within the range [0.0, 1.0].

This module provides a customizable horizontal slider, suitable for use in forms, settings panels, media controls, or any scenario where users need to adjust a continuous value. The slider supports mouse and keyboard interaction, visual feedback for dragging and focus, and allows full control over appearance and behavior via configuration options and callbacks.

Typical use cases include volume controls, progress bars, brightness adjustments, and other parameter selection tasks.

The slider is fully controlled: you provide the current value and handle updates via a callback. State management (e.g., dragging, focus) is handled externally and passed in, enabling integration with various UI frameworks.

See SliderArgs and SliderState for configuration and state management details.

Structs§

SliderArgs
Arguments for the slider component.
SliderArgsBuilder
Builder for SliderArgs.
SliderState
Stores the interactive state for the slider component, such as whether the slider is currently being dragged by the user. This struct should be managed via Arc<Mutex<SliderState>> and passed to the slider function to enable correct interaction handling.

Enums§

SliderArgsBuilderError
Error type for SliderArgsBuilder

Functions§

slider
Renders a slider UI component that allows users to select a value in the range [0.0, 1.0].