forms
Tailwind CSS Range
A range slider is used to modify a value by sliding a handle along a track, allowing for precise adjustments.
Basic input range
example.
<input type="range" class="range" aria-label="range" />
The Range inputs are stacked in three sizes:extra small xs
, small sm
, default, and large lg
.
<input type="range" class="range range-xs" aria-label="range" />
<input type="range" class="range range-sm" aria-label="range" />
<input type="range" class="range" aria-label="range" />
<input type="range" class="range range-lg" aria-label="range" />
<input type="range" class="range range-xl" aria-label="range" />
The standard format for range is accompanied by the component class range
and modifier class range-{semantic-color}
.
<input type="range" class="range" aria-label="range" />
<input type="range" class="range range-primary" aria-label="primary range" />
<input type="range" class="range range-secondary" aria-label="secondary range" />
<input type="range" class="range range-info" aria-label="info range" />
<input type="range" class="range range-success" aria-label="success range" />
<input type="range" class="range range-warning" aria-label="warning range" />
<input type="range" class="range range-error" aria-label="error range" />
Utilize [--range-color:]
to incorporate your custom color.
<input type="range" class="range [--range-color:teal]" aria-label="custom range" />
Apply the disabled
boolean attribute to a range input to disable pointer events and prevent focusing.
<input type="range" class="range" aria-label="disabled range" disabled />
Range inputs inherently have default values for min
and max
- 0 and 100, respectively. You can customize these values using the min
and max
attributes.
<input type="range" class="range" min="0" max="100" value="40" aria-label="range">
The step
attribute specifies the interval between legal numbers in an <input>
element.
|
|
|
|
|
<input type="range" min="0" max="100" value="25" class="range" step="25" aria-label="range" />
<div class="w-full flex justify-between text-xs px-2">
<span>|</span>
<span>|</span>
<span>|</span>
<span>|</span>
<span>|</span>
</div>