Range

Range sliders let users pick a numeric value from a bounded interval with native keyboard and form behavior.

Usage Example
@rangeinput.Range(rangeinput.Config{
    ID:    "mood",
    Name:  "mood",
    Label: "Mood Meter",
    Value: "20",
    Min:   "0",
    Max:   "100",
    Step:  "1",
})

Range with Ticks

ShowTicks renders a responsive tick row below the slider. Provide Ticks to customize the labels.

Range with Ticks
@rangeinput.Range(rangeinput.Config{
    ID:        "moodTicks",
    Name:      "mood",
    Label:     "Mood Meter",
    Value:     "20",
    Step:      "5",
    ShowTicks: true,
})

Range with Icons

LeadingIcon and TrailingIcon frame the slider with semantic icon labels while the native input remains the interactive control.

Range with Icons
@rangeinput.Range(rangeinput.Config{
    ID:           "brightnessIcons",
    Name:         "brightness",
    Label:        "Brightness",
    Value:        "20",
    LeadingIcon:  rangeSunDimIcon(),
    TrailingIcon: rangeSunIcon(),
})

Range with Value

ShowValue adds a compact Alpine.js value badge that updates as the slider moves.

20
Range with Value
@rangeinput.Range(rangeinput.Config{
    ID:        "volumeValue",
    Name:      "volume",
    Label:     "Volume",
    Value:     "20",
    ShowValue: true,
})

Disabled Range

Disabled blocks interaction and dims the control.

Disabled Range
@rangeinput.Range(rangeinput.Config{
    ID:       "disabledRange",
    Name:     "disabled",
    Label:    "Disabled",
    Value:    "40",
    Disabled: true,
})

API Reference

PropTypeDefaultDescription
IDstring""Unique id for the range input and label target.
Namestring""Form field name.
Labelstring""Visible label for the slider.
Valuestring"0"Current value.
Minstring"0"Minimum value.
Maxstring"100"Maximum value.
Stepstring"1"Increment between valid values.
DisabledboolfalseDisables the slider.
RequiredboolfalseMarks the input as required.
ShowTicksboolfalseRenders a tick row below the input.
Ticks[]TicknilCustom tick labels; empty uses the default min-to-max scale.
ShowValueboolfalseRenders a live Alpine.js value badge.
LeadingIcontempl.ComponentnilIcon component rendered before the control.
TrailingIcontempl.ComponentnilIcon component rendered after the control.
RootClassstring""Extra classes on the container.
InputClassstring""Extra classes on the range input.
InputAttrstempl.AttributesnilArbitrary attributes on the input (e.g. hx-post, x-on:input, data-*).