---
title: "स्लाइडर फ़ील्ड"
description: "लोगों को किसी स्केल पर एक मान, या मानों की रेंज, चुनने देता है, एक पूरे फ़ील्ड के रूप में — लेबल के नीचे ट्रैक, लेबल की पंक्ति के अंत में शब्दों में मान, सहायता की एक पंक्ति, और वह कारण जिससे कोई मान माना नहीं गया।"
url: "https://tanrei.chnotchy.com/hi/components/slider-field/"
last_updated: 2026-10-23T21:17:12.000Z
---

# स्लाइडर फ़ील्ड

> लोगों को किसी स्केल पर एक मान, या मानों की रेंज, चुनने देता है, एक पूरे फ़ील्ड के रूप में — लेबल के नीचे ट्रैक, लेबल की पंक्ति के अंत में शब्दों में मान, सहायता की एक पंक्ति, और वह कारण जिससे कोई मान माना नहीं गया।

## अवलोकन

स्लाइडर फ़ील्ड उस मान के लिए इस्तेमाल करें जो अंदाज़ से चुना जाता है और शब्दों में वापस पढ़ा जाता है: 120 % का टेक्स्ट साइज़, 5 km की दूरी, $100 से $300 तक की क़ीमत। अकेले स्लाइडर का कोई दिखने वाला लेबल नहीं होता, और उसका ट्रैक यह नहीं बताता कि वह किस मान पर सेट है। स्लाइडर फ़ील्ड आम स्थिति के लिए है, इस्तेमाल के लिए तैयार: एक लेबल, शब्दों में मान, ट्रैक, सहायता की एक पंक्ति और त्रुटि।

**किनसे बना है:** एक [फ़ील्ड](https://tanrei.chnotchy.com/hi/components/field/) और एक [स्लाइडर](https://tanrei.chnotchy.com/hi/components/slider/) से। फ़ील्ड फ़्रेम है: लेबल, ज़रूरी या वैकल्पिक का निशान, लेबल की पंक्ति के अंत में मान टेक्स्ट, सहायता और त्रुटि। स्लाइडर कंट्रोल है: ट्रैक, हैंडल और वह सब जो व्यक्ति उनके साथ करता है। स्लाइडर फ़ील्ड अपना कुछ नहीं बनाता और उसका कोई टोकन नहीं है: उसकी हर प्रॉपर्टी इन दोनों में से किसी एक की प्रॉपर्टी है, जो उसी को बिना बदले दे दी जाती है; अपवाद सिर्फ़ `valueHidden` है, जो उसकी अपनी है।

यह उतना ही चौड़ा है जितनी वह जगह जिसमें इसे रखा गया है, और इसका ट्रैक उसे पूरा भरता है।

वेब पर यह `<tanrei-slider-field>` है। बाक़ी प्लैटफ़ॉर्म ने इसे अभी इम्प्लीमेंट नहीं किया है।

### इस्तेमाल

`value` हैंडल का मान है, और रेंज में अंतिम हैंडल का; `startValue` रेंज का शुरुआती हैंडल है। दोनों इवेंट स्लाइडर के अपने हैं: `input` व्यक्ति के ड्रैग करते समय हर बदलाव पर, और `change` एक बार, जब बदलाव पूरा हो जाता है। जब इनमें से कोई सुना जाता है, तब फ़ील्ड के `value` और `startValue` में नए मान आ चुके होते हैं।

**Web**

```html
<form>
  <tanrei-slider-field name="text-size" label="टेक्स्ट का साइज़"
    supporting-text="हर पेज पर लागू होता है।"
    min="50" max="200" step="10" value="120"></tanrei-slider-field>

  <!-- रेंज एक ही नाम से पहले start-value सबमिट करती है, फिर value। हर हैंडल को नाम दें। -->
  <tanrei-slider-field name="price" label="क़ीमत" range
    min="0" max="500" step="10" start-value="100" value="300"
    start-label="न्यूनतम क़ीमत" end-label="अधिकतम क़ीमत"></tanrei-slider-field>
</form>

<script type="module">
  import '@tanrei/web/components/slider-field';

  // मान के शब्द, एक बार दिए गए: यह प्रॉपर्टी है, ऐट्रिब्यूट कभी नहीं।
  const percent = new Intl.NumberFormat(document.documentElement.lang, { style: 'percent' });
  const size = document.querySelector('[name="text-size"]');
  size.formatValue = (value) => percent.format(value / 100);
  size.addEventListener('input', () => applyTextSize(size.value));

  const dollars = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 });
  document.querySelector('[name="price"]').formatValue = (value) => dollars.format(value);
</script>
```

**React**

```tsx
import { SliderField } from '@tanrei/react';

<SliderField name="text-size" label="टेक्स्ट का साइज़" supportingText="हर पेज पर लागू होता है।"
  min={50} max={200} step={10} value={size}
  formatValue={(value) => percent.format(value / 100)}
  onInput={(event) => setSize(event.currentTarget.value)} />
```

### शब्दों में मान

मान लेबल की पंक्ति के अंत में दिखाया जाता है, उन्हीं शब्दों में जो स्लाइडर अपने हैंडल को देता है: वही शब्द जो स्क्रीन रीडर सुनाता है और मान इंडिकेटर दिखाता है। वे इस क्रम में तय होते हैं:

| शब्द | कब |
| --- | --- |
| `valueText`, और रेंज के शुरुआती हैंडल के लिए `startValueText` | शब्द आप ख़ुद लिखते हैं, और हर `input` पर दोबारा लिखते हैं। |
| जो `formatValue` लिखता है | आप एक फ़ंक्शन एक बार देते हैं, जो मान से उसके शब्द बनाता है। स्लाइडर हर बदलाव पर हर हैंडल के लिए उससे शब्द माँगता है। |
| पेज के लोकेल में संख्या | दोनों में से कुछ नहीं दिया गया। |

रेंज के दोनों मान एक एन डैश से जोड़े जाते हैं, पढ़ने के क्रम में: दाएँ से बाएँ वाले लेआउट में शुरुआत के शब्द दाईं ओर रहते हैं, जहाँ शुरुआती हैंडल है। स्लाइडर फ़ील्ड ख़ुद कोई संख्या, इकाई या शब्द नहीं लिखता।

मान टेक्स्ट लेबल की पहली पंक्ति की बेसलाइन पर रहता है, और लेबल बची हुई जगह में रैप होता है। जहाँ इससे लेबल के लिए पंक्ति के आधे से कम जगह बचे, वहाँ मान टेक्स्ट लेबल के बाद अपनी अलग पंक्ति लेता है, और ज़रूरत हो तो वहीं रैप होता है। `valueHidden` उसे हटा देता है, उस स्लाइडर के लिए जिसकी संख्या व्यक्ति के लिए कोई मतलब नहीं रखती: वॉल्यूम, ब्राइटनेस। हैंडल फिर भी सहायक तकनीक को अपना मान बताता है।

### एक स्तर नीचे

वही फ़ील्ड, अपने दोनों सदस्यों से हाथ से लिखा हुआ, वही तस्वीर है और सहायक तकनीक के लिए वही स्लाइडर:

```html
<tanrei-field label="टेक्स्ट का साइज़" supporting-text="हर पेज पर लागू होता है।" value-text="120 %">
  <tanrei-slider name="text-size" min="50" max="200" step="10" value="120"></tanrei-slider>
</tanrei-field>

<script type="module">
  const field = document.querySelector('tanrei-field');
  const slider = field.querySelector('tanrei-slider');
  slider.formatValue = (value) => percent.format(value / 100);
  // जो स्लाइडर फ़ील्ड ख़ुद करता है: हर बदलाव पर फ़ील्ड का मान टेक्स्ट स्लाइडर का मान टेक्स्ट होता है।
  slider.addEventListener('input', () => (field.valueText = slider.shownValueText));
</script>
```

एक स्तर नीचे तब जाएँ जब आपको ऐसी व्यवस्था चाहिए जो स्लाइडर फ़ील्ड नहीं देता:

| आपको चाहिए | इस्तेमाल करें |
| --- | --- |
| लेबल, शब्दों में मान, ट्रैक, सहायता और त्रुटि | स्लाइडर फ़ील्ड |
| ऐसा मान टेक्स्ट जो स्लाइडर नहीं कहता, जैसे कोई वाक्य या “कोई भी क़ीमत”, या फ़्रेम के भीतर अपनी कोई चीज़ | एक [फ़ील्ड](https://tanrei.chnotchy.com/hi/components/field/), जिसके भीतर एक [स्लाइडर](https://tanrei.chnotchy.com/hi/components/slider/) है, और आपका अपना `value-text` |
| सिर्फ़ ट्रैक, जिसे नाम कहीं और दिखाई गई कोई चीज़ देती है: टेबल का कॉलम, टूलबार का ग्लिफ़, प्लेयर का वॉल्यूम कंट्रोल | अकेला [स्लाइडर](https://tanrei.chnotchy.com/hi/components/slider/), जिसे नाम उसके अपने `label` से मिलता है |
| खड़ा स्लाइडर | अकेला [स्लाइडर](https://tanrei.chnotchy.com/hi/components/slider/): स्लाइडर फ़ील्ड का कोई ओरिएंटेशन नहीं है |
| ऐसा मान जो पहले से पता है और टाइप किया जाता है | [नंबर फ़ील्ड](https://tanrei.chnotchy.com/hi/components/number-field/), अकेला या स्लाइडर के बग़ल में |

एक स्तर नीचे जो बदलता है, वह यह है कि कौन-सी बात कहाँ कही जाती है। `name`, `value` और `startValue` स्लाइडर पर होते हैं, जो तब वह कंट्रोल है जो फ़ॉर्म को मिलता है, और उसके इवेंट उसी पर सुने जाते हैं। `label` और `disabled` फ़ील्ड पर ही रहते हैं, जो उन्हें स्लाइडर तक पहुँचाता है। रेंज के अंतिम हैंडल को नाम स्लाइडर का अपना `label` देता है, जिसे स्लाइडर फ़ील्ड `endLabel` कहता है।

## स्पेक

### हर सदस्य क्या देता है

| पहलू | फ़ील्ड से | स्लाइडर से |
| --- | --- | --- |
| प्रॉपर्टी | `label`, `labelHidden`, `supportingText`, `errorText`, `error`, `disabled`, `required`, `optional`, `requiredMark`, `requiredText`, `optionalText` | `value`, `startValue`, `range`, `min`, `max`, `step`, `origin`, `stops`, `size`, `valueIndicator`, `valueText`, `startValueText`, `startLabel`, और `endLabel`, जो स्लाइडर का `label` है |
| इवेंट | — | `input`, `change` |
| स्लॉट | `label-icon` | — |
| टोकन | `comp.field.*` | `comp.slider.*` |

एक प्रॉपर्टी स्लाइडर फ़ील्ड की अपनी है: `valueHidden`। और फ़ील्ड की एक प्रॉपर्टी स्लाइडर फ़ील्ड ख़ुद भरता है, और उसे सेट करना आपका काम नहीं है: फ़ील्ड का `valueText`, जो स्लाइडर के शब्दों से आता है।

स्लाइडर के अपने `disabled` और `orientation` होते हैं। दोनों में से कोई स्लाइडर फ़ील्ड की प्रॉपर्टी नहीं है: फ़ील्ड का `disabled` स्लाइडर को अक्षम करता है, ताकि लेबल और मान टेक्स्ट भी साथ बदलें, और ट्रैक हमेशा इनलाइन दिशा में चलता है: स्लाइडर फ़ील्ड का कोई खड़ा ओरिएंटेशन नहीं होता।

स्लाइडर में हमेशा कोई मान होता है, इसलिए यहाँ `required` का मतलब “ख़ाली नहीं” नहीं है। जो फ़ॉर्म हर कंट्रोल को ज़रूरी या वैकल्पिक के रूप में चिह्नित करता है, वह इसे भी करता है; वह क्या नहीं मानता, जैसे 0 का स्तर या बहुत सँकरी रेंज, यह `error` और `errorText` से बताना आपका काम है। त्रुटि ट्रैक में कुछ नहीं बदलती: उसे शब्द और अमान्य स्टेट बताते हैं।

हैंडल क्या करते हैं, यानी ड्रैग करना, कुंजियाँ, स्टेप, मान इंडिकेटर, यह [स्लाइडर के पेज](https://tanrei.chnotchy.com/hi/components/slider/) पर है। फ़्रेम क्या करता है, यानी ज़रूरी का निशान, मान टेक्स्ट, सहायता, त्रुटि और वह कैसे पढ़कर सुनाई जाती है, यह [फ़ील्ड के पेज](https://tanrei.chnotchy.com/hi/components/field/) पर है।

### किसी एक फ़ील्ड को अलग करना

स्लाइडर फ़ील्ड का अपना कोई टोकन नहीं है। उसका फ़्रेम फ़ील्ड के टोकन पढ़ता है, और उसका ट्रैक स्लाइडर के, वे जहाँ भी सेट हों। किसी एक इंस्टेंस को बदलने के लिए, उस पर सदस्य का टोकन सेट करें:

```html
<tanrei-slider-field label="वॉल्यूम" value="40"
  style="--tanrei-comp-field-standard-value-text-color: var(--tanrei-sys-color-on-surface)"></tanrei-slider-field>
```

- Category: Selection
- Level: composed
- Listing: default
- Built from: Field, Slider
- Page: https://tanrei.chnotchy.com/components/slider-field/
- Spec: https://github.com/chnotchy/tanrei/blob/main/specs/slider-field.spec.json

### Availability

| Design system | Has it | Notes |
| --- | --- | --- |
| Tanrei (`tanrei`) | Yes | — |
| Cupertino (Apple HIG-inspired) (`cupertino`) | Yes | — |
| M3 Expressive-like (Material 3 Expressive-inspired) (`m3-expressive-like`) | Yes | — |
| M3-like (Material 3-inspired) (`m3-like`) | Yes | — |

### Platforms

- Web: the element `<tanrei-slider-field>`, registered by importing `@tanrei/web` (or only its own module, `@tanrei/web/components/slider-field`).
- React: `SliderField` from `@tanrei/react`.

| Platform | Name | Status |
| --- | --- | --- |
| Web | `tanrei-slider-field` | lagging |
| SwiftUI | `TanreiSliderField` | planned |
| Jetpack Compose | `TanreiSliderField` | planned |
| Flutter | `TanreiSliderField` | planned |
| React Native | `SliderField` | planned |

Names a platform gives in its own idiom:

| Spec | Web | SwiftUI | Jetpack Compose | Flutter | React Native |
| --- | --- | --- | --- | --- | --- |
| `label` (prop) | `label` | `label` | `label` | `labelText` | `label` |
| `labelHidden` (prop) | `labelHidden` | `labelsHidden` | `labelHidden` | `labelHidden` | `labelHidden` |
| `supportingText` (prop) | `supportingText` | `supportingText` | `supportingText` | `helperText` | `supportingText` |
| `error` (prop) | `error` | `error` | `isError` | `isError` | `error` |
| `disabled` (prop) | `disabled` | `disabled` | `enabled` | `enabled` | `disabled` |
| `required` (prop) | `required` | `isRequired` | `required` | `required` | `required` |
| `optional` (prop) | `optional` | `isOptional` | `optional` | `optional` | `optional` |
| `startValue` (prop) | `startValue` | `value` | `value` | `start` | `startValue` |
| `range` (prop) | `range` | `value` | `value` | `range` | `range` |
| `min` (prop) | `min` | `bounds` | `valueRange` | `min` | `minimumValue` |
| `max` (prop) | `max` | `bounds` | `valueRange` | `max` | `maximumValue` |
| `stops` (prop) | `stops` | `showsStops` | `showStops` | `showStops` | `stops` |
| `valueText` (prop) | `valueText` | `valueText` | `stateDescription` | `semanticValue` | `valueText` |
| `startValueText` (prop) | `startValueText` | `startValueText` | `startStateDescription` | `startSemanticValue` | `startValueText` |
| `startLabel` (prop) | `startLabel` | `startLabel` | `startContentDescription` | `startSemanticLabel` | `startAccessibilityLabel` |
| `endLabel` (prop) | `endLabel` | `endLabel` | `endContentDescription` | `endSemanticLabel` | `endAccessibilityLabel` |
| `input` (event) | `input` | `value` | `onValueChange` | `onChanged` | `onValueChange` |
| `change` (event) | `change` | `onCommit` | `onValueChangeFinished` | `onChangeEnd` | `onSlidingComplete` |

Statuses: `planned` — In the inventory. Nothing shippable exists yet. `lagging` — An implementation of an earlier spec exists; it has not caught up with the current one. `alpha` — Implemented with tests. The API may still change. `beta` — Feature complete and at parity. Only fixes are expected. `stable` — Covered by semantic versioning. `deprecated` — Still shipped; scheduled for removal.

### Anatomy

- `field`: The Field itself: the label row with its label glyph, its requirement mark and, at its end, the value text; and the supporting row with the help and the error text. Drawn by the Field from the Field's tokens. A member: it frames the component.
- `slider`: The Slider itself, as the Field's one control: its track, active track, handles, stop dots, state layer, value indicator and focus ring, drawn by the Slider from the Slider's tokens. A member: it holds the component's value.

### Props

| Prop | Type | Default | Web attribute | Description |
| --- | --- | --- | --- | --- |
| `label` | `string` | `""` | `label` | Names the control, visibly and to assistive technology. Required, unless the control names itself (a checkbox or a switch with its own label): then leave it empty and the field adds only help and an error. (From Field: Drawn above the track and, for one handle, its accessible name. While range is true it is the visible name of the pair, and each handle is named by startLabel and endLabel (SLF-5).) |
| `labelHidden` | `boolean` | `false` | `label-hidden` | Does not draw the label, which stays the accessible name. For a control whose visible label is elsewhere (a table column, a toolbar). (From Field: The label row takes the value text with it (FLD-29).) |
| `supportingText` | `string` | `""` | `supporting-text` | Help shown below the control and given to assistive technology as the control's description. While the field is in error it gives way to errorText, unless the design system keeps both (comp.field.error-text.placement append). (From Field.) |
| `errorText` | `string` | `""` | `error-text` | Shown while error is true, in supportingText's place — or below it, which then stays, where the design system's comp.field.error-text.placement is append: what is wrong and how to put it right, in words. (From Field.) |
| `error` | `boolean` | `false` | `error` | Puts the field in the error condition: the error text is drawn, the control is exposed as invalid and, where it has an error condition of its own, drawn in it. What a value means is the product's to validate; the field never sets this itself. (From Field: A slider has no error condition of its own to draw (FLD-8): the track and the handles stay as they are, and each handle is exposed as invalid.) |
| `disabled` | `boolean` | `false` | `disabled` | Disables the control and draws the frame as disabled. Disable a framed control here, not on the control, so that its label follows. (From Field: The one disabled of the slider field: the Field passes it to the Slider (FLD-14, SLD-20), whose own disabled is not a prop here, so that the label and the value text always follow.) |
| `required` | `boolean` | `false` | `required` | What the form asks of the control: true exposes it as required and draws the required mark beside the label. It never validates: a missing answer is the product's to report with error. (From Field.) |
| `optional` | `boolean` | `false` | `optional` | Draws the optional tag after the label and adds optionalText to the control's description, because assistive technology has no state for it. Ignored while required is true: a control is never both. (From Field.) |
| `requiredMark` | `enum`: `auto`, `tag`, `asterisk`, `none` | `"auto"` | `required-mark` | How this control shows that it is required: tag is a small filled Tag with requiredText, asterisk is "*" after the label, none draws nothing and keeps the semantics. Auto takes comp.field.requirement.mark, which follows sys.behavior.requirement-mark, the system's one answer. Ignored unless required is true. (From Field.) |
| `requiredText` | `string` | `""` | `required-text` | The text of the required tag, in the product's language ("Required", "必須"). The product's: Tanrei has no word for it. Empty reads the product's words; with neither, FLD-24 says what is drawn. (From Field.) |
| `optionalText` | `string` | `""` | `optional-text` | The text of the optional tag, in the product's language ("Optional", "任意"); also read to assistive technology as part of the description. The product's: Tanrei has no word for it. Empty reads the product's words. (From Field.) |
| `value` | `number` | `0` | `value` | The value of the only handle, or of a range's end handle. (From Slider.) |
| `startValue` | `number` | `0` | `start-value` | The value of a range's start handle. Ignored while range is false. (From Slider.) |
| `range` | `boolean` | `false` | `range` | Draws two handles, choosing the range from startValue to value (a price filter). (From Slider.) |
| `min` | `number` | `0` | `min` | The lowest value, at the track's start. (From Slider.) |
| `max` | `number` | `100` | `max` | The highest value, at the track's end. (From Slider.) |
| `step` | `number` | `0` | `step` | 0 is continuous. Above 0 the slider is discrete: its values are min plus whole multiples of step, up to max. (From Slider.) |
| `origin` | `number` | — | `origin` | Where the active track starts. Null starts it at min. A value inside the range makes a centered slider (a balance control) whose active track grows toward either side. Ignored while range is true. (From Slider.) |
| `stops` | `boolean` | `false` | `stops` | Draws a stop dot at every value a discrete slider can take. Meant for a few steps; ignored while step is 0. (From Slider.) |
| `size` | `enum`: `small`, `medium`, `large` | `"small"` | `size` | The track's weight and the stop dots' size (and, where a system says so, the handle's height). Small is the everyday slider; medium and large give a prominent control (a volume or brightness slider) more weight. The hit area always meets the minimum target. A design system may add values. (From Slider: Changes nothing of the frame.) |
| `valueIndicator` | `enum`: `none`, `active`, `always` | `"none"` | `value-indicator` | Whether a handle shows its value beside it: never, while it is pressed or has keyboard focus, or all the time. (From Slider.) |
| `valueText` | `string` | `""` | `value-text` | The value as words ("40 %", "3 stars"), spoken and shown by the value indicator in place of the number. For a range, the end handle's. (From Slider: Also drawn at the end of the label row (SLF-3).) |
| `startValueText` | `string` | `""` | `start-value-text` | The start handle's valueText, for a range. (From Slider.) |
| `startLabel` | `string` | `""` | `start-label` | Names a range's start handle ("Minimum price"). Required while range is true. (From Slider.) |
| `endLabel` | `string` | `""` | `end-label` | Names the slider (a range's end handle) for assistive technology. Never drawn: a visible label is the product's text next to the slider, in the same words. Required. (From Slider: The Slider's label under the name of the handle it names, because label is the visible name here. Read only while range is true, and required then (SLF-5).) |
| `valueHidden` | `boolean` | `false` | `value-hidden` | Does not draw the value at the end of the label row. For a slider set by feel, whose number means nothing to the person (a volume, a brightness). The handle still says its value to assistive technology, and valueIndicator still shows it. |

### Events

| Event | Description |
| --- | --- |
| `input` | The person changed a value; carries value and, for a range, startValue. Emitted for every change during a drag, not when the product sets a value. (From Slider.) |
| `change` | The person finished changing a value (the press ended, or a key or assistive-technology adjustment was made); carries value and, for a range, startValue. Always after the input it follows. (From Slider.) |

### Slots

| Slot | Description |
| --- | --- |
| `label-icon` | A glyph before the label. (From Field.) |

### States

`enabled`, `disabled`, `hovered`, `focused`, `pressed`, `error`

### Accessibility

- Role: `slider`
- Labeling: The slider field has no role of its own: assistive technology meets the Slider's handles, each a slider (SLD-19), What the slider field ties together (SLF-5): label is the accessible name of the only handle; a range's two handles are named by startLabel and endLabel; the supporting text with, in error, the error text after it is every handle's description, with optionalText while optional is true; every handle is invalid while error is true and required, or described by requiredText where the role has no required state, while required is true. Each handle's value is said in the words of SLD-18 — valueText, or what the product's function writes, or the platform's number — and the same words are drawn at the end of the label row, where they are kept from assistive technology so that a value is not read twice (FLD-30).
- Minimum target size: yes

| Keys | Action |
| --- | --- |
| Tab / Shift+Tab | Moves focus to the handle — for a range to the start handle, then the end handle — and on from it: the stops are the Slider's, and the slider field adds none (SLF-7). |
| Every other key | The Slider's own, as its spec's keyboard table says (SLD-3). The slider field handles no key. |

- Everything else is a member's and is said in its spec: the Field's rows, requirement marks, error announcement and press on the label (FLD-2 to FLD-12); the Slider's roles, value limits, target size and contrast (SLD-7, SLD-19 and its accessibility notes).
- A value a person cannot read is a value only some people are told. The handle says its value to assistive technology, and a track does not say it to the eye; the value text at the end of the label row is drawn unless valueHidden says the number means nothing to the person.
- A number with a unit is words, and the words are the product's: valueText for a value the product writes itself, or one function from a value to its words, given once, which the Slider asks at every change (SLD-18). The slider field writes none, and joins a range's two with an en dash, which is a mark.
- A slider always has a value, so required does not mean "not empty" here: a product that marks every control of a form as required or optional marks this one too, and says with error and errorText what it refuses (a level of 0, a range too narrow).
- Dragging is never the only way (WCAG 2.5.7): a press on the track moves the handle to it, and the keys step it (SLD-2, SLD-3). A value that must be entered exactly is a number field, alone or beside a slider.
- How a state looks is a value decision of the active design system; components read the state's tokens and never compute the effect themselves.

### Behaviour

Requirements in EARS form, each with its stable id.

- **SLF-1** THE slider field SHALL be a Field whose one control is a Slider — the two components themselves, each drawn from its own tokens in every state and behaving by its own sentences (FLD-1 to FLD-24, FLD-29 and FLD-30; SLD-1 to SLD-26) — and SHALL draw nothing of its own, have no token of its own, and give neither member a look, a state or a size that the member does not have where it stands alone.
- **SLF-2** THE slider field SHALL give each member the value of every prop that is that member's, at once and whenever it changes, and SHALL hold none back: the Field takes label, labelHidden, supportingText, errorText, error, disabled, required, optional, requiredMark, requiredText, optionalText and the glyph of the label-icon slot; the Slider takes value, startValue, range, min, max, step, origin, stops, size, valueIndicator, valueText, startValueText, startLabel and, as its own label, endLabel. THE slider field SHALL give the Slider no orientation, so that the track always runs along the line (SLD-21), and SHALL NOT set the Slider's own disabled: the Field disables its control (FLD-14).
- **SLF-3** WHILE valueHidden is false THE slider field SHALL give the Field, as its value text (FLD-29), the words the Slider gives its handle as that handle's value (SLD-18): WHILE range is false the only handle's; WHILE range is true the start handle's, an en dash with a space on each side, and the end handle's, each of the two an isolated run and the two in reading order, so that in a right-to-left layout the start's words stand at the right of the dash as the start handle stands at the right of the track. THE slider field SHALL NOT write a number, a unit or a word itself. WHILE valueHidden is true THE slider field SHALL give the Field no value text.
- **SLF-4** WHEN a value changes — at every input of a drag, by a key, by assistive technology, because the product set value or startValue, or because min, max or step changed what the Slider draws (SLD-22) — or valueText, startValueText or the product's function for a value changes, THE slider field SHALL show the new value text in the same frame in which the handle is drawn at its new place, without a motion and without an announcement of its own: the handle says its value to assistive technology itself (SLD-19), and the Field keeps the drawn text from it (FLD-30).
- **SLF-5** WHILE range is false THE slider field SHALL have its handle named by label, as the Field names its control (FLD-10). WHILE range is true THE slider field SHALL have the start handle named by startLabel and the end handle by endLabel (SLD-19), which should each hold the words of label so that what is seen is in what is heard, and WHILE either is empty SHALL have that handle named by label and in debug builds report that a handle of a range has no name of its own. THE slider field SHALL have every handle described by the text the supporting row shows, with optionalText while optional is true (FLD-11), and exposed as invalid while error is true (FLD-8); WHILE required is true it SHALL have every handle exposed as required where the platform's slider has such a state and, where it has none (the web's slider role), SHALL have requiredText added to the handle's description instead.
- **SLF-6** THE slider field SHALL hold value and startValue as its own and report them as the Slider does: WHEN the Slider emits input or change THE slider field SHALL emit the same event exactly once, carrying value and, for a range, startValue (SLD-2 to SLD-4), with its own value and startValue already equal to what the event carries; WHEN the product sets value or startValue THE slider field SHALL emit nothing (SLD-16). WHERE the platform has forms THE slider field SHALL be the one control the form sees — it carries the name, submits what the Slider submits, is reset and restored as the Slider is, and submits nothing WHILE disabled is true — and neither member SHALL be a second one.
- **SLF-7** THE slider field SHALL add no stop to the focus order and handle no key: its only focus stops are the Slider's handles, in the Slider's order (SLD-5), and every key is the Slider's (SLD-3). WHEN focus is given to the slider field itself, or the person presses the label row (FLD-12), THE slider field SHALL move focus to the only handle and, WHILE range is true, to the start handle, and SHALL change no value.
- **SLF-8** WHILE disabled is true THE slider field SHALL be a disabled Field holding a disabled Slider (FLD-14, SLD-20): no handle takes focus or changes, no event is emitted, the value indicator is not shown, and the label, the requirement mark, the supporting row and the value text are drawn from the Field's disabled tokens; THE slider field SHALL keep the value text drawn, because what a disabled control is set to is still read.
- **SLF-9** WHILE the text size is enlarged THE slider field SHALL grow as the Field grows (FLD-16) and SHALL leave the Slider's track, handles and hit area as they are (SLD-7); at 200% in a width of 320 no text SHALL be cut, lie over another part or need scrolling in two directions: the label wraps beside the value text, and a value text too wide to share the label's line moves whole to a line of its own (FLD-29).
- **SLF-10** THE slider field SHALL take its layout direction from where it is used and have no direction setting of its own, and its two members SHALL take the same one (FLD-19, SLD-25). WHERE the layout direction is right-to-left the frame and the track mirror together — the label row starts at the right with the value text at its left end (FLD-18), the track runs from the right (min) to the left (max) and the arrow keys follow it (SLD-21) — and the words of a value SHALL NOT be mirrored: each is laid out as text of its own direction (FLD-21, SLD-26), so that a number keeps its digits, its sign and its unit in their own order.
- **SLF-11** WHERE the platform draws with a person's own forced colors THE slider field SHALL add nothing and remove nothing: the Field draws its texts as FLD-17 says and the Slider its track and handles as it does standing alone, and the error SHALL still be carried by the words of errorText and by the invalid state of each handle (FLD-8), never by a color.
- **SLF-12** THE slider field SHALL be, in what is drawn and in what assistive technology is told, exactly what a Field holding a Slider is when a product writes the two by hand with the same props and gives the Field the same value text, which is the one prop of a member the slider field fills itself: every fixture of the slider field and its twin among the Field's fixtures are the same picture, with the same names, descriptions, values and states, and a difference is a defect of the slider field.
- **SLF-13** THE slider field SHALL be a block as wide as its place in the layout, with no width of its own, and its Slider SHALL fill it from the start edge to the end edge, as a Slider standing in a Field does (FLD-1); the label row and the supporting row are as wide as the track's box.
- **SLF-14** WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE slider field SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the element that carries its role — an id reference by the elements it names in the host's tree or a tree around it, an error message as part of the description while the slider field is invalid — except those the slider field owns (aria-label, aria-labelledby, aria-disabled), which it SHALL move and not expose: its name is label (SLF-5). WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE slider field SHALL take it off that element. WHEN the product sets an aria- attribute the slider field owns THE slider field SHALL report it in debug builds.

### Tokens

As written in the token documents (DTCG): an alias in braces names the token it takes its value from, which each design system resolves. On the web each token is a CSS custom property: `--tanrei` and the name after `tanrei`, joined by hyphens (`tanrei.comp.field.…` → `--tanrei-comp-field-…`).

#### `tanrei.comp.field`

| Token | Type | Value |
| --- | --- | --- |
| `comp.field.label.typescale` | `typography` | `{tanrei.sys.typescale.label}` |
| `comp.field.label.gap` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.field.label-icon.size` | `dimension` | `{tanrei.sys.icon.small}` |
| `comp.field.label-icon.gap` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.field.requirement.mark` | `number` | `{tanrei.sys.behavior.requirement-mark}` |
| `comp.field.requirement.gap` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.field.requirement.asterisk-gap` | `dimension` | `{tanrei.sys.space.space25}` |
| `comp.field.supporting-text.typescale` | `typography` | `{tanrei.sys.typescale.label-small}` |
| `comp.field.supporting-text.gap` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.field.counter.gap` | `dimension` | `{tanrei.sys.space.space200}` |
| `comp.field.motion.state-duration` | `duration` | `{tanrei.sys.motion.role.state.default}` |
| `comp.field.motion.state-easing` | `cubicBezier` | `{tanrei.sys.motion.easing.state}` |
| `comp.field.standard.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.field.standard.label-icon.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.supporting-text.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.counter.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.required-asterisk.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.field.standard.error.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.field.standard.error.label-icon.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.error.supporting-text.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.error.counter.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.error.required-asterisk.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.field.standard.error.value-text.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.value-text.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field.standard.error-text.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.field.value-text.typescale` | `typography` | `{tanrei.sys.typescale.label}` |
| `comp.field.value-text.gap` | `dimension` | `{tanrei.sys.space.space200}` |
| `comp.field.error-text.gap` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.field.error-text.placement` | `number` | `0` |

Per-state tokens, valued by the design system's pattern rules (not written by hand):

- `comp.field.<variant>.<state>.<property>` for the variants `standard`, the states `focused`, `disabled` and the properties `label.color`, `label-icon.color`, `supporting-text.color`, `required-asterisk.color`, `error.label.color`, `error.label-icon.color`, `error.supporting-text.color`, `error.required-asterisk.color`, `counter.color`, `error.counter.color`, `value-text.color`, `error.value-text.color`, `error-text.color`.

### वेब क्या अलग ढंग से बनाता है

- एलिमेंट के शैडो रूट में एक `<tanrei-field>` रहता है, जिसके भीतर एक `<tanrei-slider>` है, और कुछ नहीं। एलिमेंट को इंपोर्ट करने से दोनों डिफ़ाइन हो जाते हैं।
- यह फ़ॉर्म से जुड़ा एलिमेंट है। वह `name` और `form` लेता है, मान सबमिट करता है (रेंज में एक ही नाम से पहले शुरुआती मान, फिर मान; अक्षम रहते कुछ नहीं), रीसेट होने पर `value` और `start-value` ऐट्रिब्यूट पर लौटता है, और अक्षम `<fieldset>` के साथ अक्षम होता है। उसके दोनों सदस्य फ़ॉर्म में कोई एंट्री नहीं जोड़ते।
- `input` और `change` स्लाइडर के CustomEvent हैं, जिनके साथ `detail.value` आता है (और रेंज के लिए `detail.startValue`)। इनका टार्गेट यही एलिमेंट है, और हर लिसनर में `event.target.value` नया मान होता है।
- `formatValue` प्रॉपर्टी है, ऐट्रिब्यूट कभी नहीं: `(value: number) => string`, या `null`।
- रेंज के दोनों मान टेक्स्ट, फ़ील्ड के `value-text` के एक ही टेक्स्ट में लिखे जाते हैं, बीच में एन डैश के साथ। हर एक अपनी दिशा वाला अलग टुकड़ा है, यानी फ़र्स्ट-स्ट्रॉन्ग आइसोलेट U+2068 और U+2069 के भीतर रखा हुआ, जब तक वह “$100” या “3,400,000” जैसी सादी संख्या न हो, जो दोनों दिशाओं में पहले से एक ही बाएँ से दाएँ वाला टुकड़ा है और जैसी है वैसी लिखी जाती है।
- भाग: `field` और `slider` दोनों सदस्य हैं। उनके अपने भागों के नाम यहाँ वही हैं जो एक स्तर नीचे हैं: `label`, `label-icon`, `requirement-label`, `value-text`, `supporting-text`; `track`, `active-track`, `stop-indicator`, `container`, `handle`, `value-indicator`।
- एलिमेंट पर ख़ुद फ़ोकस नहीं जा सकता: `focus()` हैंडल पर जाता है, रेंज में शुरुआती हैंडल पर, और पेज का अपना `<label for>` फ़ोकस वहीं ले जाता है।
- एलिमेंट का कोई रोल नहीं है। उसे `label` से नाम दें, और जहाँ लेबल कहीं और दिखाया गया है वहाँ साथ में `label-hidden` दें। उसे `aria-label` से कभी नाम न दें, जो यहाँ किसी चीज़ को नाम नहीं देता।
- ऐट्रिब्यूट सदस्यों के अपने हैं: `label-hidden`, `supporting-text`, `error-text`, `required-mark`, `required-text`, `optional-text`, `start-value`, `value-indicator`, `value-text`, `start-value-text`, `start-label`; और `end-label`, `value-hidden`।
- एलिमेंट के डिफ़ाइन होने से पहले उसका कोई साइज़ नहीं होता और वह सिर्फ़ `label-icon` वाला चाइल्ड दिखाता है। जिस पेज को स्क्रिप्ट के बिना काम करना है, वह सादे `<input type="range">` के चारों ओर एक `<label>` इस्तेमाल करता है।

## दिशानिर्देश

### करें

- जहाँ अकेली संख्या साफ़ नहीं होगी, वहाँ मान के शब्द `formatValue` से दें: प्रतिशत, मुद्रा, इकाई।
- रेंज के दोनों हैंडल को `startLabel` और `endLabel` से नाम दें, ऐसे शब्दों में जिनमें `label` के शब्द हों: “क़ीमत” के नीचे “न्यूनतम क़ीमत”, “अधिकतम क़ीमत”।
- मान से क्या बदलता है, यह `supportingText` में बताएँ, जहाँ लेबल यह नहीं बताता।
- क्या नहीं माना गया, यह शब्दों में बताएँ, `error` और `errorText` से।
- `valueHidden` उस मान के लिए इस्तेमाल करें जो अंदाज़ से सेट किया जाता है और जिसकी संख्या व्यक्ति को कुछ नहीं बताती।

### न करें

- जिस स्लाइडर को व्यक्ति चला सकता है, उसके लिए मार्कअप में `valueText` एक बार न लिखें: पहले ड्रैग के बाद शब्द ग़लत हो जाएँगे। `formatValue` दें, या हर `input` पर `valueText` दोबारा लिखें।
- स्लाइडर फ़ील्ड को फ़ील्ड के भीतर न रखें। वह पहले से एक फ़ील्ड है; डीबग बिल्ड यह बताता है।
- उसे `aria-label` से नाम न दें। जहाँ कोई लेबल नहीं दिखाना है, वहाँ `label` और `labelHidden` दें।
- मान दिखाने के लिए `valueIndicator="always"` इस्तेमाल न करें: यह काम मान टेक्स्ट करता है, और इंडिकेटर लेबल की पंक्ति के ऊपर आ जाएगा।
- जिस मान को बिलकुल सटीक होना है, उसके लिए स्लाइडर फ़ील्ड इस्तेमाल न करें। [नंबर फ़ील्ड](https://tanrei.chnotchy.com/hi/components/number-field/) इस्तेमाल करें, अकेला या इसके बग़ल में।

## सुलभता

### कंपोनेंट क्या सँभालता है

- हर हैंडल एक स्लाइडर है। अकेले हैंडल का नाम `label` से आता है, चाहे वह दिखाया गया हो या नहीं; रेंज के दोनों हैंडल के नाम `startLabel` और `endLabel` से, और जहाँ कोई एक नहीं दिया गया वहाँ `label` से, जिसकी रिपोर्ट डीबग बिल्ड करता है।
- हर हैंडल का विवरण दिखाया जा रहा सहायक या त्रुटि टेक्स्ट है, और जब तक फ़ील्ड वैकल्पिक है, उसके साथ वैकल्पिक का टेक्स्ट। जब तक `error` true है, वह अमान्य के रूप में दिया जाता है, और जब तक `disabled` true है, अक्षम के रूप में। वेब के slider रोल में ज़रूरी का कोई स्टेट नहीं है, इसलिए ज़रूरी स्लाइडर फ़ील्ड `requiredText` विवरण में कहता है।
- हर हैंडल अपना मान शब्दों में बताता है। वही शब्द लेबल की पंक्ति के अंत में दिखाए जाते हैं, जहाँ वे सहायक तकनीक से छिपे रहते हैं, इसलिए मान एक ही बार पढ़ा जाता है।
- दिखने वाला लेबल, ज़रूरी या वैकल्पिक का निशान और मान टेक्स्ट सहायक तकनीक को दूसरी बार नहीं दिए जाते, और मान टेक्स्ट का बदलना पढ़कर नहीं सुनाया जाता: हैंडल अपना मान ख़ुद बताता है।
- फ़ोकस के क्रम में इसके पड़ाव स्लाइडर के हैंडल हैं, एक या रेंज के दो, और हर कुंजी स्लाइडर की है। लेबल की पंक्ति पर दबाने से फ़ोकस हैंडल पर आता है और कुछ नहीं बदलता; सहायता पर दबाने से कुछ नहीं होता।
- अक्षम रहते हुए भी मान टेक्स्ट दिखता रहता है: अक्षम कंट्रोल किस मान पर सेट है, यह तब भी पढ़ा जाता है।
- दिशा, बड़ा किया गया टेक्स्ट और फ़ोर्स्ड कलर्स, इन सबको हर सदस्य अपने ढंग से सँभालता है: दाएँ से बाएँ वाले लेआउट में फ़्रेम और ट्रैक साथ-साथ मिरर होते हैं और मान के शब्द अपना क्रम बनाए रखते हैं; 200% टेक्स्ट पर कुछ नहीं कटता और कुछ भी आड़ा स्क्रॉल नहीं होता।
- इसके अपने कोई शब्द नहीं हैं। `requiredText` और `optionalText` ख़ाली छोड़े जाएँ तो फ़ील्ड उन्हें प्रॉडक्ट के शब्दों से पढ़ता है।

वेब पर ज्ञात कमियाँ: एलिमेंट के डिफ़ाइन होने से पहले कुछ नहीं दिखता, और रेंज के दोनों हैंडल सहायक तकनीक को `label` के नाम वाले एक ग्रुप के रूप में नहीं दिए जाते।

### आपको क्या करना है

- `label` हमेशा दें, और रेंज के लिए `startLabel` और `endLabel` भी।
- जहाँ अकेली संख्या समझ में नहीं आएगी, वहाँ मान के शब्द दें, और मान बदलते समय उन्हें सही रखें।
- क्या नहीं माना गया, यह `errorText` से बताएँ। रंग कभी अकेला संकेत नहीं होता।
- जहाँ व्यक्ति को सटीक मान दर्ज करना है, वहाँ स्लाइडर के बग़ल में एक नंबर फ़ील्ड दें: ड्रैग करना कभी हैंडल चलाने का अकेला तरीक़ा नहीं होता, पर वह मान टाइप करने का तरीक़ा फिर भी नहीं है।
