Range Input
Shared label and supporting-text behaviour is summarised on Inputs overview.
catnip-range-input
Props
Value & constraints
| Prop | Type | Default | Description |
|---|---|---|---|
| modelValue | number | 50 | Numeric value; model-value in HTML / .modelValue in frameworks. |
| min | number | 0 | Minimum selectable value. |
| max | number | 100 | Maximum selectable value. |
| step | number | 1 | Increment used by pointer, touch, and keyboard interactions. |
Field presentation
| Prop | Type | Default | Options | Description |
|---|---|---|---|---|
| label | string | "" | — | Visible field label when the label slot is empty. |
| optional | boolean | false | — | When true and not required, shows the localized optional hint. |
| optionalText | string | "" | — | Overrides the localized optional hint (HTML: optional-text). |
| info | string | "" | — | Info tooltip beside the label; when non-empty, it wins over the label.suffix slot. |
| alignment | "left" | "center" | "right" | "left" | left, center, right | Horizontal alignment of the field label block. |
| requiredMarker | string | "*" | — | Visual marker for required fields (HTML: required-marker). |
| requiredScreenReaderText | string | "" | — | Optional screen-reader supplement; it does not replace required on the control (HTML: required-screen-reader-text). |
| supportingText | SupportingTextProp | "" | — | One or more helper or validation messages. Each object requires text; intent accepts neutral, danger, warning, or success, and icon accepts a Catnip icon name. See supporting-text examples. |
Range presentation
| Prop | Type | Default | Description |
|---|---|---|---|
| showMinMaxLabels | boolean | true | Shows the min and max labels beside the slider. |
| minLabel | string | "" | Custom min label. Falls back to min. |
| maxLabel | string | "" | Custom max label. Falls back to max. |
| showValueTooltip | boolean | false | Shows the current value above the thumb at rest. When false, the value tooltip still appears while the range is hovered, focused, or being dragged. |
| showInputField | boolean | false | Shows an optional numeric input bound to the same value. Invalid typed drafts use danger styling while editing. |
| valueInputAriaLabel | string | "" | Accessible name for the optional numeric value input. |
| valueFormatter | (value: number) => string | undefined | Formats the value for the tooltip and for screen readers (aria-valuetext), for example (value) => `${value} %` or names for the ends. Set it as a DOM property (.valueFormatter). The value field keeps the plain number. |
State
| Prop | Type | Default | Options | Description |
|---|---|---|---|---|
| size | "m" | "l" | "m" | m, l | Dimensions and typography. |
| intent | "neutral" | "danger" | "warning" | "success" | "neutral" | neutral, danger, warning, success | Semantic state applied to field and supporting-text styling; danger sets aria-invalid on the active value control while the slider track and thumb keep their normal colors. |
| disabled | boolean | false | — | Disables the range and optional value input. |
| readonly | boolean | false | — | Prevents user changes while keeping the control focusable. |
| required | boolean | false | — | Native required and label marker. |
| rangeInputAriaLabel | string | "" | — | aria-label when there is no visible label. |
| ariaDescribedby | string | "" | — | IDs of elements in the page, or in the shadow root the element sits in, that describe the field. They're resolved there and connected to the inner control by element reflection, read before the supporting text. |
Advanced
| Prop | Type | Default | Description |
|---|---|---|---|
| rangeInputId | string | "" | DOM id for the range input. Auto-generated when omitted. |
| name | string | "" | Native name for form submission. |
| rangeInputAutofocus | boolean | false | Forwards native autofocus to the range input; use sparingly. |
| hideLabel | boolean | false | Visually hides the label row; label still names the slider. |
| testSelectors | TestSelectorsProp | See Test selectors | Overrides stable data-test values. |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | number | Value changed: from the slider, a step, or a valid value typed in the value field. Typed values out of range or off the step aren't emitted. |
Slots
| Name | Description |
|---|---|
| label | Custom label content; falls back to label prop. |
| label.action | Trailing action in the label row. |
| label.suffix | Custom label suffix; used only when info is empty. |
Test selectors
| Attribute | Default | Applies to |
|---|---|---|
root | catnip-range-input | Field wrapper |
control | catnip-range-input-control | Native range input |
minLabel | catnip-range-input-min-label | Minimum label |
maxLabel | catnip-range-input-max-label | Maximum label |
valueTooltip | catnip-range-input-value-tooltip | Current value tooltip |
valueInput | catnip-range-input-value-input | Optional numeric value input |
supportingText | catnip-range-input-supporting-text | Supporting message |