 Search
components/badge: Badge components/button: Button components/checkbox: Checkbox components/input: Input components/popover: Popover components/dialog: Dialog components/pre: Pre components/radio: Radio components/range: Range components/separator: Separator components/spinner: Spinner components/switch: Switch components/table: Table components/textarea: Textarea components/tooltip: Tooltip components/typography: Typography plugins/plugin-nf: Nerd Font Plugin plugins/theme-catppuccin: Catppuccin Theme plugins/theme-everforest: Everforest Theme plugins/theme-gruvbox: Gruvbox Theme plugins/theme-nord: Nord Theme plugins/theme-vitesse: Vitesse Theme start/ascii-boxes: ASCII Boxes start/changelog: Changelog start/intro: Introduction start/intro: ## Features start/plugins: Plugins start/plugins: ## Official Plugins start/plugins: ### Themes start/plugins: ## Community Plugins contributing/contributing: Contributing contributing/contributing: ## Local Development contributing/contributing: ## Issues contributing/contributing: ## Pull Requests contributing/style-guide: Style Guide contributing/style-guide: ## CSS Units contributing/style-guide: ## Selectors contributing/style-guide: ## Documentation plugins/plugin-dev: Developing Plugins plugins/plugin-dev: ### Style Layers start/tuis-vs-guis: TUIs vs GUIs start/tuis-vs-guis: ## Monospace Fonts start/tuis-vs-guis: ## Character Cells installation/nextjs: Next.js installation/vite: Vite start/theming: Theming start/theming: ## CSS Variables start/theming: ### Font Styles start/theming: ### Colors start/theming: ### Light & Dark start/theming: ## Theme Plugins start/theming: ### Using Multiple Theme Accents start/installation: Installation start/installation: ## Installation start/installation: ## Using CSS start/installation: ## Using ESM start/installation: ## Using a CDN start/installation: ## Full Library Import start/installation: ### CSS start/installation: ### ESM start/installation: ### CDN installation/astro: Astro installation/astro: ## Scoping installation/astro: ### Frontmatter Imports installation/astro: ### <style> tag installation/astro: ### Full Library Import

Range

A range slider input

1 <input type="range" min="0" max="100" value="50" />

Import

@import "@webtui/css/components/range.css";

Usage

<input type="range" />

Examples

Basic Range

1
2 <input type="range" min="0" max="100" value="25" />
3 <input type="range" min="0" max="100" value="50" />
4 <input type="range" min="0" max="100" value="75" />
5
1
2 body {
3 display: flex;
4 flex-direction: column;
5 gap: 1lh;
6 }

Track Styles

1
2 <input type="range" min="0" max="100" value="40" />
3 <input type="range" bar-="thick" min="0" max="100" value="50" />
4 <input type="range" bar-="line" min="0" max="100" value="60" />
5
1
2 body {
3 display: flex;
4 flex-direction: column;
5 gap: 1lh;
6 }

With Labels

1
2 <label>
3 Volume
4 <input type="range" min="0" max="100" value="25" />
5 </label>
6 <label>
7 Brightness
8 <input type="range" min="0" max="100" value="75" />
9 </label>
10 <label>
11 Warmth
12 <input type="range" min="0" max="100" value="50" disabled />
13 </label>
14
1 body {
2 display: flex;
3 flex-direction: column;
4 gap: 1lh;
5 }

Disabled State

1
2 <label>
3 Enabled
4 <input type="range" min="0" max="100" value="50" />
5 </label>
6
7 <label>
8 Disabled
9 <input type="range" min="0" max="100" value="30" disabled />
10 </label>
11
1
2 body {
3 display: flex;
4 flex-direction: column;
5 gap: 1lh;
6 }

Reference

Properties

Use CSS custom properties to customize the range appearance

  • --range-track-color: Color of the slider track
  • --range-thumb-color: Default color of the slider thumb
  • --range-thumb-color-focus: Color of the slider thumb when focused or active
  • --range-track-height: Height of the track
#my-range {
  --range-track-color: var(--background2);
  --range-thumb-color: var(--foreground2);
  --range-thumb-color-focus: var(--foreground0);
}

Extending

To extend the Range stylesheet, define a CSS rule on the components layer

@layer components {
    input[type="range"] {
        &[variant-="accent"] {
            --range-track-color: var(--accent-color);
            --range-thumb-color: var(--accent-foreground);
        }

        /* ... */
    }
}

Scope

  • All <input type="range"> elements
input[type="range"] { /* ... */ }