<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-input-range-value/usage/ in the magma monorepo.
-->

# mds-input-range-value - mistakes

> The API of this component: [`AGENTS.md`](AGENTS.md).

Common incorrect uses of `<mds-input-range-value>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules (boolean-as-string, shadow piercing, Tailwind color utilities, raw native event listening) live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.

#### Do Not Use It Outside `<mds-input-range>`

A value draws nothing: only its range draws its thumb.

```html
<!-- INCORRECT -->
<mds-input-range-value value="20">Minimo</mds-input-range-value>

<!-- CORRECT -->
<mds-input-range min="0" max="100">
  Prezzo
  <mds-input-range-value value="20">Minimo</mds-input-range-value>
</mds-input-range>
```

#### Do Not Put the Label of the Range in a Value

The text of the range is its label, the text of a value names its own thumb. A value that carries the label leaves the range unnamed and names one thumb after the whole group.

```html
<!-- INCORRECT -->
<mds-input-range>
  <mds-input-range-value value="20">Prezzo</mds-input-range-value>
  <mds-input-range-value value="80"></mds-input-range-value>
</mds-input-range>

<!-- CORRECT -->
<mds-input-range>
  Prezzo
  <mds-input-range-value value="20">Minimo</mds-input-range-value>
  <mds-input-range-value value="80">Massimo</mds-input-range-value>
</mds-input-range>
```

#### Do Not Read the Values from `value` of the Range

With values, `value` and `mdsInputRangeChange` of the range are left out: they hold the one value of a range without children. Read the children, `mdsInputRangeValuesChange` or the form.

```js
// INCORRECT
range.addEventListener('mdsInputRangeChange', (e) => console.log(e.detail));

// CORRECT
range.addEventListener('mdsInputRangeValuesChange', (e) => console.log(e.detail.values));
```
