Skip to content

Slider

Slider edits a controlled floating-point value. Its default range is 0.0F through 1.0F.

Row {
Slider(volume)
.Range(0.0F, 100.0F)
.Step(1.0F)
.OnChanged([volume](float next) {
volume = next;
}),
Text::Format("{}%", static_cast<int>(volume)),
}.With(
Spacing(12.0F),
CrossAlign(CrossAxisAlignment::Center)
)

.Range(minimum, maximum) defines the legal interval. .Step(step) snaps requested values to discrete increments. The caller must feed accepted values back into the next composition.

Pointer dragging, keyboard range adjustment, focus, and accessibility increment or decrement actions share the same controlled output path.

The slider exposes role, current range, optional step, enabled state, and focus semantics automatically.

SliderStyle lets a theme vary track gaps, tick treatment, stop indicators, thumb geometry, colors, focus treatment, and motion without changing the controlled value contract.

  • Constructors: Slider(float) and Slider(State<float>).
  • Fluent methods: .Range(float minimum, float maximum), .Step(float).
  • Event: .OnChanged(function) with float.
  • Theme style: SliderStyle.

Use ProgressBar when the value is display-only.