Skip to main content

Range

The native <input type="range"> gets a flat track and a square-ish thumb that goes a bit darker on hover and shrinks a little while you drag it. Users who prefer reduced motion do not get the shrink. Add the .default class to keep the browser style.

index.html
<label for="volume" class="form-label">Volume</label>
<input type="range" id="volume" min="0" max="100" value="40" />

The range takes the full width of its parent, wrap it in an element with a fixed width if you want it shorter.

Customization​

The range uses the same CSS variables as other form elements:

VariableDefaultUsed for
--flatify__form-element-bg-colorvar(--flatify__bg-color-dark)Thumb background
--flatify__form-element-border-colorvar(--flatify__bg-color-darker)Track and thumb border
--flatify__form-element-border-color__focusvar(--flatify__form-element-accent-color)Thumb border on focus
style.css
.my-range {
--flatify__form-element-bg-color: #ffce54;
--flatify__form-element-border-color: #f6bb42;
}