# Range Slider (`<z-input-range>`)

> Custom slider with a draggable knob, filled track, optional value label, and a two-knob range mode.

- **Kind:** hwc
- **Category:** inputs
- **Inherits:** `InputMixin`, `Hwc`, `Base`

## Attributes

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `multiple` | `boolean` | `false` | — | Enables two knobs (low/high) selecting a range; the value submits as two entries. |
| `min` | `number` | `0` | — | Minimum value (default 0). |
| `max` | `number` | `100` | — | Maximum value (default 100). |
| `step` | `number` | `1` | — | Step increment (default 1). |
| `label` | `string \| boolean` | `false` | — | Shows a value label following the knob. |
| `label-position` | `'top' \| 'bottom'` | `'top'` | — | Label placement relative to the track: `top` (default) or `bottom`. |
| `aria-label` | `string` | `''` | — | Accessible label of the slider group (defaults to the `aria-label` i18n text). |

### Inherited from `InputMixin`

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `disabled` | `boolean` | `false` | `InputMixin` | Disables the control so it cannot be interacted with. |
| `form` | `string` | `''` | `InputMixin` | Associates the hidden form input with a form by id, even when the component sits outside that form. |
| `name` | `string` | `''` | `InputMixin` | Field name for the hidden form input; array values submit as `name[]`. |
| `placeholder` | `string` | `''` | `InputMixin` | Placeholder text for the control's empty state. |
| `required` | `boolean` | `false` | `InputMixin` | Marks the control as required. |
| `value` | `string` | `''` | `InputMixin` | Initial value of the control, synchronized with the hidden form input. |

### Inherited from `Hwc`

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `i18n` | `string` | `''` | `Hwc` | Per-instance text overrides as `key: text` pairs, merged over the global `z-i18n` script and the built-in defaults. |
| `floating` | `string` | `''` | `Hwc` | Floating UI placement options (for example `offset` and `shiftPadding`) parsed as `key: value` pairs. |
| `force-prevent-rerender` | `boolean` | `false` | `Hwc` | Skips re-rendering after the first render; an existing `data-host-inner` child is adopted as the rendered DOM. |
| `template` | `string` | `''` | `Hwc` | Selector or id of an external element or `<template>` whose inner content is cloned in place of an inline `template[data-fn="template"]` child. |

### Inherited from `Base`

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `cls` | `string` | `''` | `Base` | Adds classes to named parts as `key: classes` pairs; a plain string targets the default part. |
| `stl` | `string` | `''` | `Base` | Adds inline styles to named parts as `key: styles` pairs; a plain string targets the default part. |

## Styling Parts (`cls` / `stl`)

Default `cls` target: `host-inner`. Default `stl` target: `host-inner`.

| Key | Default class | cls | stl | Description |
| --- | --- | --- | --- | --- |
| `fill` | — | ✓ | — | The filled portion of the track. |
| `host-inner` | `z-input-range` | ✓ | ✓ | The slider root (default `z-input-range`); the default `cls`/`stl` target. |
| `knob` | — | ✓ | — | The draggable knob. |
| `knob-dragging` | — | ✓ | — | Class applied to the knob while dragging. |
| `label` | — | ✓ | ✓ | The value label. |
| `label-bottom` | — | ✓ | — | Class positioning the label below the track. |
| `label-top` | — | ✓ | — | Class positioning the label above the track. |
| `runnable` | — | ✓ | ✓ | The clickable/draggable track area. |

## CSS Variables

| Variable | Default | Scope | Affects | Description |
| --- | --- | --- | --- | --- |
| `--z-input-range-fill-bg` | `var(--z-primary)` | `.z-input-range-fill` | `background-color` | Fill base color, mixed with transparency using `--z-input-range-fill-bg-o`. |
| `--z-input-range-fill-bg-o` | `100%` | `.z-input-range-fill` | `background-color` | Fill opacity percentage used in the color mix. |
| `--z-input-range-knob-bg` | `var(--z-bg)` | `.z-input-range-knob` | `background-color` | Knob base color, mixed with transparency using `--z-input-range-knob-bg-o`. |
| `--z-input-range-knob-bg-o` | `100%` | `.z-input-range-knob` | `background-color` | Knob opacity percentage used in the color mix. |
| `--z-input-range-knob-border-color` | `var(--z-primary)` | `.z-input-range-knob` | `border` | Knob border base color, mixed with transparency using `--z-input-range-knob-border-color-o`. |
| `--z-input-range-knob-border-color-o` | `50%` | `.z-input-range-knob` | `border` | Knob border opacity percentage used in the mix. |
| `--z-input-range-knob-radius` | `9999px` | `.z-input-range-knob` | `border-radius` | Corner radius of the knob. |
| `--z-input-range-knob-shadow` | `var(--z-global-shadow)` | `.z-input-range-knob` | `box-shadow` | Box shadow of the knob. |
| `--z-input-range-knob-size` | `1rem` | `.z-input-range-knob` | `height`, `width` | Diameter of the knob. |
| `--z-input-range-label-offset-y` | `2.5rem` | `.z-input-range` | `inset-block-start` | Vertical offset of the value label from the track. |
| `--z-input-range-track-bg` | `var(--z-primary)` | `.z-input-range-runnable` | `background-color` | Track base color, mixed with transparency using `--z-input-range-track-bg-o`. |
| `--z-input-range-track-bg-o` | `20%` | `.z-input-range-runnable` | `background-color` | Track opacity percentage used in the color mix. |
| `--z-input-range-track-height` | `0.375rem` | `.z-input-range` | `height` | Height of the track. |
| `--z-input-range-track-radius` | `var(--z-global-radius)` | `.z-input-range` | `border-radius` | Corner radius of the track. |

## i18n Keys

| Key | Default | Description |
| --- | --- | --- |
| `aria-label` | `Range slider` | Default accessible label of the slider group. |
| `aria-range-text` | `Range from {low} to {high}` | Range value text template with `{low}` and `{high}`. |
| `aria-value-text` | `Value: {value}` | Single-knob value text template with `{value}`. |
| `high-knob-label` | `Maximum value` | Accessible label of the high knob. |
| `low-knob-label` | `Minimum value` | Accessible label of the low knob. |

## Events

| Event | Cancelable | Detail | Description |
| --- | --- | --- | --- |
| `z-input-range:input` | — | `{ value: string \| string[] }` | Fires when the value changes; `detail.value` carries the value (two entries in range mode). |

## Data Hooks

| Attribute | Values | Applies to | Role | Description |
| --- | --- | --- | --- | --- |
| `data-disabled` | — | `descendant` | `marker` | Set while the control is disabled. |
| `data-dragging` | — | `descendant` | `marker` | Set while a knob is being dragged. |
| `data-fill-track` | — | `descendant` | `marker` | Marks the fill element. |
| `data-host-inner` | — | `descendant` | `config` | Marks the rendered inner wrapper so `force-prevent-rerender` can adopt server-rendered DOM without re-rendering. |
| `data-label-position` | — | `descendant` | `marker` | Set to the label position (`top`/`bottom`). |
| `data-multiple` | — | `descendant` | `marker` | Set in two-knob range mode. |
| `data-range-track` | — | `descendant` | `marker` | Marks the track element. |
| `data-reactive` | — | `descendant` | `config` | Opts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates. |

## Child Content

- `<script data-fn="config">` — JSON configuration script parsed by the base class (i18n, cls, stl, floating).

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `config` | Marks the script as configuration (value: `config`). |
  | `data-reactive` | — | `boolean` | Re-parses the configuration when the script mutates. |

- `<select data-fn="data-source">` — Hidden select parsed into grouped option data by the base class.

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `data-source` | Marks the select as the data source (value: `data-source`). |
  | `data-reactive` | — | `boolean` | Re-parses the options when the select mutates. |

  - `<optgroup>` — Groups options under a label.

    | Attribute | Required | Type | Description |
    | --- | --- | --- | --- |
    | `label` | ✓ | `string` | Group header text; also the default group key. |
    | `disabled` | — | `boolean` | Disables every option in the group. |
    | `data-key` | — | `string` | Overrides the group key used in the parsed data. |
    | `data-keywords` | — | `comma-separated string` | Comma-separated keywords stored with the group's data. |

    - `<option>` — One option entry within the group.

      | Attribute | Required | Type | Description |
      | --- | --- | --- | --- |
      | `value` | — | `string` | Value carried by this option in the parsed data. |
      | `disabled` | — | `boolean` | Makes the option non-selectable. |
      | `selected` | — | `boolean` | Marks the option as initially selected. |
      | `data-keywords` | — | `comma-separated string` | Extra search terms, comma-separated; searched alongside the label and value. |

  - `<option>` — One ungrouped option entry.

    | Attribute | Required | Type | Description |
    | --- | --- | --- | --- |
    | `value` | — | `string` | Value carried by this option in the parsed data. |
    | `disabled` | — | `boolean` | Makes the option non-selectable. |
    | `selected` | — | `boolean` | Marks the option as initially selected. |
    | `data-keywords` | — | `comma-separated string` | Extra search terms, comma-separated. |

- `<template data-fn="icons">` — Instance-level icon repository.

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `icons` | Marks the template as an icon source (value: `icons`). |
  | `data-reactive` | — | `boolean` | Re-parses the icons when the template mutates. |

  - `<*>` — One icon element.

    | Attribute | Required | Type | Description |
    | --- | --- | --- | --- |
    | `data-key` | ✓ | `string` | Icon key referenced by `$icons`. |

- `<template data-fn="template">` — Deferred content template mounted by the base class.

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `template` | Marks the template for deferred mounting (value: `template`). |
  | `data-reactive` | — | `boolean` | Re-parses the template when it mutates. |

## CSS Classes

| Class | Role | Applies to | Description |
| --- | --- | --- | --- |
| `.z-input-range` | `root` | `z-input-range` | Root class of the slider. |
| `.z-input-range-fill` | `element` | `.z-input-range` | The filled track portion. |
| `.z-input-range-knob` | `element` | `.z-input-range` | The draggable knob. |
| `.z-input-range-label` | `element` | `.z-input-range` | The value label. |
| `.z-input-range-label-bottom` | `element` | `.z-input-range` | Label below the track. |
| `.z-input-range-label-top` | `element` | `.z-input-range` | Label above the track. |
| `.z-input-range-runnable` | `element` | `.z-input-range` | The interactive track area. |

## Keyboard

| Keys | Action | When |
| --- | --- | --- |
| `ArrowLeft` / `ArrowRight` / `ArrowUp` / `ArrowDown` | Adjusts the focused knob by one step. | — |
| `PageUp` / `PageDown` | Adjusts the focused knob by ten steps. | — |
| `Home` / `End` | Jumps to the minimum (low knob: its own minimum) or maximum. | — |

## Accessibility

| Part | Attributes | Description |
| --- | --- | --- |
| `fill` | — | Fill element; no ARIA attributes. |
| `host-inner` | `aria-label="${ariaLabel}"`, `role="group"` | Slider group: `role="group"` labeled by `aria-label`. |
| `knob` | `aria-disabled="${this.disabled}"`, `aria-label="${this.getKnobAriaLabel(type)}"`, `aria-valuemax="${max}"`, `aria-valuemin="${min}"`, `aria-valuenow="${value}"`, `aria-valuetext="${this.getAriaValueText(value)}"`, `role="slider"` | Knob: `role="slider"` with `aria-valuemin`/`aria-valuemax`/`aria-valuenow`/`aria-valuetext`, labeled per knob, `aria-disabled` when disabled. |
| `label` | — | Value label; no ARIA attributes. |
| `runnable` | — | Track area; no ARIA attributes. |

> Each knob is a slider with live value text; in range mode the group text announces `low` to `high`.

> The value submits through the hidden form input(s).

## Notes

- Clicking the track moves the nearest knob; dragging suppresses the follow-up click.
- In range mode the knobs cannot cross; the fill spans between them.

## Guides

- [Styling with cls and stl](https://next.0build.dev/docs/guides/styling.md)
- [Translating Components](https://next.0build.dev/docs/guides/i18n.md)
- [Icon Resolution](https://next.0build.dev/docs/guides/icons.md)
- [The data-source Convention](https://next.0build.dev/docs/guides/data-source.md)
- [Openers & Triggers](https://next.0build.dev/docs/guides/triggers.md)
- [Dialog Behavior](https://next.0build.dev/docs/guides/dialogs.md)
- [Utilities](https://next.0build.dev/docs/guides/utilities.md)
- [Runtime](https://next.0build.dev/docs/guides/runtime.md)

## Related

- [PIN Input](https://next.0build.dev/docs/components/input-pin.md)
- [Time Input](https://next.0build.dev/docs/components/input-time.md)
