Skip to content

Commit 320f713

Browse files
authored
docs: Minor range example code optimization (#41665)
I think the 'custom' prefix for the ids in examples were mainly from Bootstrap v4 custom controls. Removing it makes it a bit shorter/neater.
1 parent ac5f51c commit 320f713

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

site/src/content/docs/forms/range.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ toc: true
88

99
Create custom `<input type="range">` controls with `.form-range`. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only Firefox supports “filling” their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.
1010

11-
<Example code={`<label for="customRange1" class="form-label">Example range</label>
12-
<input type="range" class="form-range" id="customRange1">`} />
11+
<Example code={`<label for="range1" class="form-label">Example range</label>
12+
<input type="range" class="form-range" id="range1">`} />
1313

1414
## Disabled
1515

@@ -22,27 +22,27 @@ Add the `disabled` boolean attribute on an input to give it a grayed out appeara
2222

2323
Range inputs have implicit values for `min` and `max``0` and `100`, respectively. You may specify new values for those using the `min` and `max` attributes.
2424

25-
<Example code={`<label for="customRange2" class="form-label">Example range</label>
26-
<input type="range" class="form-range" min="0" max="5" id="customRange2">`} />
25+
<Example code={`<label for="range2" class="form-label">Example range</label>
26+
<input type="range" class="form-range" min="0" max="5" id="range2">`} />
2727

2828
## Steps
2929

3030
By default, range inputs “snap” to integer values. To change this, you can specify a `step` value. In the example below, we double the number of steps by using `step="0.5"`.
3131

32-
<Example code={`<label for="customRange3" class="form-label">Example range</label>
33-
<input type="range" class="form-range" min="0" max="5" step="0.5" id="customRange3">`} />
32+
<Example code={`<label for="range3" class="form-label">Example range</label>
33+
<input type="range" class="form-range" min="0" max="5" step="0.5" id="range3">`} />
3434

3535
## Output value
3636

3737
The value of the range input can be shown using the `output` element and a bit of JavaScript.
3838

39-
<Example code={`<label for="customRange4" class="form-label">Example range</label>
40-
<input type="range" class="form-range" min="0" max="100" value="50" id="customRange4">
41-
<output for="customRange4" id="rangeValue" aria-hidden="true"></output>
39+
<Example code={`<label for="range4" class="form-label">Example range</label>
40+
<input type="range" class="form-range" min="0" max="100" value="50" id="range4">
41+
<output for="range4" id="rangeValue" aria-hidden="true"></output>
4242
4343
<script>
4444
// This is an example script, please modify as needed
45-
const rangeInput = document.getElementById('customRange4');
45+
const rangeInput = document.getElementById('range4');
4646
const rangeOutput = document.getElementById('rangeValue');
4747
4848
// Set initial value

0 commit comments

Comments
 (0)