md-slider spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
Choose a value, or a range, along a continuum. Horizontal or vertical, single or two-thumb range, discrete steps with tick marks, value indicators, and an optional inset icon that travels with the handle.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" style="inline-size: 320px;"></md-slider>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Volume" value="60" valueIndicator valueText="60 percent" style={{ inlineSize: '320px' }}></MdSlider>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" style="inline-size: 320px;"></md-slider><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" style="inline-size: 320px;"></md-slider>
</template><script>
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" style="inline-size: 320px;"></md-slider>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-slider in your project: Option A registers every AWC UI
component at once (simplest), Option B imports only this component for
tree-shake-friendly bundles.
<!-- ─── Option A: global registration (all components) ─── -->
<script type="module">
import '@awc-ui/core/define';
</script>
<!-- ─── Option B: single import (tree-shake only md-slider) ─── -->
<script type="module">
import '@awc-ui/core/components/md-slider';
</script>
<md-slider></md-slider>// ─── Option A: typed React wrapper (registers all components) ───
// Importing from '@awc-ui/react' calls defineCustomElements() as a
// side effect, so every md-* element becomes available in the browser.
import { MdSlider } from '@awc-ui/react';
export function Example() {
return <MdSlider></MdSlider>;
}
// ─── Option B: single import (tree-shake to only md-slider) ───
// Skip the wrapper and use the raw custom element. Smallest bundle,
// but you lose typed props/events on JSX.
import '@awc-ui/core/components/md-slider';
export function ExampleTreeShaken() {
return <md-slider></md-slider>;
}// ─── Option A: schema module (any md-* element accepted) ───
// Pair with `defineCustomElements(window)` in main.ts.
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `<md-slider></md-slider>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-slider'` in main.ts.
import { Component } from '@angular/core';
import { MdSlider } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdSlider],
template: `<md-slider></md-slider>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdSlider } from '@awc-ui/vue';
</script>
<template>
<MdSlider></MdSlider>
</template>
<!-- ─── Option B: single import (tree-shake to only md-slider) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-slider';
</script>
<template>
<md-slider></md-slider>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-slider></md-slider>
<!-- ─── Option B: single import (tree-shake to only md-slider) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-slider';
</script>
<md-slider></md-slider>range): price filter, date span, thresholds.| Situation | Use instead |
|---|---|
| A precise number the user knows | md-text-field with type="number" |
| An unbounded value | md-text-field |
| A small set of discrete choices | md-segmented-button / md-radio |
| On / off | md-switch |
| A subjective score out of N | md-rating |
| Fine-grained input on touch | md-text-field alongside the slider |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Extra small" size="xs" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Small" size="sm" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Medium" size="md" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Large" size="lg" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Extra large" size="xl" value="50" style="inline-size: 300px;"></md-slider>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Extra small" size="xs" value="50" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider aria-label="Small" size="sm" value="50" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider aria-label="Medium" size="md" value="50" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider aria-label="Large" size="lg" value="50" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider aria-label="Extra large" size="xl" value="50" style={{ inlineSize: '300px' }}></MdSlider>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Extra small" size="xs" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Small" size="sm" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Medium" size="md" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Large" size="lg" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Extra large" size="xl" value="50" style="inline-size: 300px;"></md-slider><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Extra small" size="xs" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Small" size="sm" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Medium" size="md" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Large" size="lg" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Extra large" size="xl" value="50" style="inline-size: 300px;"></md-slider>
</template><script>
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Extra small" size="xs" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Small" size="sm" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Medium" size="md" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Large" size="lg" value="50" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Extra large" size="xl" value="50" style="inline-size: 300px;"></md-slider>variant="centered" fills outward from the midpoint — use it for ± adjustments
such as balance or exposure. range gives two thumbs.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Standard" value="40" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Balance" variant="centered" min="-50" max="50" value="0" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Standard" value="40" size="md" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider aria-label="Balance" variant="centered" min="-50" max="50" value="0" size="md" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider range min="0" max="1000" step="10" valueStart="200" valueEnd="800" labelStart="Minimum price" labelEnd="Maximum price" valueStartText="$200" valueEndText="$800" size="md" style={{ inlineSize: '300px' }}></MdSlider>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Standard" value="40" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Balance" variant="centered" min="-50" max="50" value="0" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Standard" value="40" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Balance" variant="centered" min="-50" max="50" value="0" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider>
</template><script>
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Standard" value="40" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Balance" variant="centered" min="-50" max="50" value="0" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider>step sets the increment; stops draws the tick marks; labeled shows a
persistent value label.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Rating" min="1" max="5" step="1" stops value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Rating with label" min="1" max="5" step="1" stops labeled value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="10" step="1" stops value-start="2" value-end="8" label-start="From" label-end="To" size="md" style="inline-size: 300px;"></md-slider>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Rating" min="1" max="5" step="1" stops value="3" size="md" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider aria-label="Rating with label" min="1" max="5" step="1" stops labeled value="3" size="md" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider range min="0" max="10" step="1" stops valueStart="2" valueEnd="8" labelStart="From" labelEnd="To" size="md" style={{ inlineSize: '300px' }}></MdSlider>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Rating" min="1" max="5" step="1" stops value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Rating with label" min="1" max="5" step="1" stops labeled value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="10" step="1" stops value-start="2" value-end="8" label-start="From" label-end="To" size="md" style="inline-size: 300px;"></md-slider><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Rating" min="1" max="5" step="1" stops value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Rating with label" min="1" max="5" step="1" stops labeled value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="10" step="1" stops value-start="2" value-end="8" label-start="From" label-end="To" size="md" style="inline-size: 300px;"></md-slider>
</template><script>
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Rating" min="1" max="5" step="1" stops value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider aria-label="Rating with label" min="1" max="5" step="1" stops labeled value="3" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="10" step="1" stops value-start="2" value-end="8" label-start="From" label-end="To" size="md" style="inline-size: 300px;"></md-slider>Only show ticks when the increments are meaningful — on a continuous scale they imply a precision that isn’t there.
value-indicator shows a value bubble above the thumb. It is persistent,
not drag-only — the bubble is there at rest, so leave room above the track for
it. labeled renders the same bubble. Pair either with value-text so screen
readers hear units rather than a bare number.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" value-indicator label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Volume" value="60" valueIndicator valueText="60 percent" size="md" style={{ inlineSize: '300px' }}></MdSlider>
<MdSlider range min="0" max="1000" step="10" valueStart="200" valueEnd="800" valueIndicator labelStart="Minimum price" labelEnd="Maximum price" valueStartText="$200" valueEndText="$800" size="md" style={{ inlineSize: '300px' }}></MdSlider>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" value-indicator label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" value-indicator label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider>
</template><script>
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Volume" value="60" value-indicator value-text="60 percent" size="md" style="inline-size: 300px;"></md-slider>
<md-slider range min="0" max="1000" step="10" value-start="200" value-end="800" value-indicator label-start="Minimum price" label-end="Maximum price" value-start-text="$200" value-end-text="$800" size="md" style="inline-size: 300px;"></md-slider>inset-icon puts a glyph inside the track that travels with the handle. Use the
icon prop, or slot your own into inset-icon.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Volume" size="lg" inset-icon icon="volume_up" value="60" style="inline-size: 320px;"></md-slider>
<md-slider aria-label="Brightness" size="xl" inset-icon value="40" style="inline-size: 320px;">
<svg slot="inset-icon" viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 7a5 5 0 100 10 5 5 0 000-10zm0-5v3m0 14v3M4.2 4.2l2.1 2.1m11.4 11.4l2.1 2.1M2 12h3m14 0h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/></svg>
</md-slider>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Volume" size="lg" insetIcon icon="volume_up" value="60" style={{ inlineSize: '320px' }}></MdSlider>
<MdSlider aria-label="Brightness" size="xl" insetIcon value="40" style={{ inlineSize: '320px' }}>
<svg slot="inset-icon" viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 7a5 5 0 100 10 5 5 0 000-10zm0-5v3m0 14v3M4.2 4.2l2.1 2.1m11.4 11.4l2.1 2.1M2 12h3m14 0h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/></svg>
</MdSlider>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Volume" size="lg" inset-icon icon="volume_up" value="60" style="inline-size: 320px;"></md-slider>
<md-slider aria-label="Brightness" size="xl" inset-icon value="40" style="inline-size: 320px;">
<svg slot="inset-icon" viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 7a5 5 0 100 10 5 5 0 000-10zm0-5v3m0 14v3M4.2 4.2l2.1 2.1m11.4 11.4l2.1 2.1M2 12h3m14 0h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/></svg>
</md-slider><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Volume" size="lg" inset-icon icon="volume_up" value="60" style="inline-size: 320px;"></md-slider>
<md-slider aria-label="Brightness" size="xl" inset-icon value="40" style="inline-size: 320px;">
<svg slot="inset-icon" viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 7a5 5 0 100 10 5 5 0 000-10zm0-5v3m0 14v3M4.2 4.2l2.1 2.1m11.4 11.4l2.1 2.1M2 12h3m14 0h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/></svg>
</md-slider>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Volume" size="lg" inset-icon icon="volume_up" value="60" style="inline-size: 320px;"></md-slider>
<md-slider aria-label="Brightness" size="xl" inset-icon value="40" style="inline-size: 320px;">
<svg slot="inset-icon" viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 7a5 5 0 100 10 5 5 0 000-10zm0-5v3m0 14v3M4.2 4.2l2.1 2.1m11.4 11.4l2.1 2.1M2 12h3m14 0h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1"/></svg>
</md-slider>orientation="vertical" turns the track upright; full-height lets it fill the
container instead of holding the fixed --md-slider-track-length.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Brightness" orientation="vertical" value="60" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Bass" orientation="vertical" min="0" max="10" step="1" stops value="4" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Treble" orientation="vertical" value="30" value-indicator size="lg" inset-icon icon="graphic_eq" style="inline-size: 64px;"></md-slider>
<div style="block-size: 240px; inline-size: 72px; display: flex; justify-content: center;">
<md-slider aria-label="Full height" orientation="vertical" full-height value="45" size="md"></md-slider>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Brightness" orientation="vertical" value="60" size="md" style={{ inlineSize: '64px' }}></MdSlider>
<MdSlider aria-label="Bass" orientation="vertical" min="0" max="10" step="1" stops value="4" size="md" style={{ inlineSize: '64px' }}></MdSlider>
<MdSlider aria-label="Treble" orientation="vertical" value="30" valueIndicator size="lg" insetIcon icon="graphic_eq" style={{ inlineSize: '64px' }}></MdSlider>
<div style={{ blockSize: '240px', inlineSize: '72px', display: 'flex', justifyContent: 'center' }}>
<MdSlider aria-label="Full height" orientation="vertical" fullHeight value="45" size="md"></MdSlider>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Brightness" orientation="vertical" value="60" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Bass" orientation="vertical" min="0" max="10" step="1" stops value="4" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Treble" orientation="vertical" value="30" value-indicator size="lg" inset-icon icon="graphic_eq" style="inline-size: 64px;"></md-slider>
<div style="block-size: 240px; inline-size: 72px; display: flex; justify-content: center;">
<md-slider aria-label="Full height" orientation="vertical" full-height value="45" size="md"></md-slider>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Brightness" orientation="vertical" value="60" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Bass" orientation="vertical" min="0" max="10" step="1" stops value="4" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Treble" orientation="vertical" value="30" value-indicator size="lg" inset-icon icon="graphic_eq" style="inline-size: 64px;"></md-slider>
<div style="block-size: 240px; inline-size: 72px; display: flex; justify-content: center;">
<md-slider aria-label="Full height" orientation="vertical" full-height value="45" size="md"></md-slider>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Brightness" orientation="vertical" value="60" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Bass" orientation="vertical" min="0" max="10" step="1" stops value="4" size="md" style="inline-size: 64px;"></md-slider>
<md-slider aria-label="Treble" orientation="vertical" value="30" value-indicator size="lg" inset-icon icon="graphic_eq" style="inline-size: 64px;"></md-slider>
<div style="block-size: 240px; inline-size: 72px; display: flex; justify-content: center;">
<md-slider aria-label="Full height" orientation="vertical" full-height value="45" size="md"></md-slider>
</div>disabled greys the track, blocks pointer and keyboard interaction, and drops
the slider out of form submission entirely.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider aria-label="Enabled" value="40" size="md"></md-slider>
<md-slider aria-label="Disabled" value="40" size="md" disabled></md-slider>
<md-slider range value-start="20" value-end="70" step="10" stops size="md" label-start="Minimum" label-end="Maximum" disabled></md-slider>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px', inlineSize: '100%', maxInlineSize: '340px' }}>
<MdSlider aria-label="Enabled" value="40" size="md"></MdSlider>
<MdSlider aria-label="Disabled" value="40" size="md" disabled></MdSlider>
<MdSlider range valueStart="20" valueEnd="70" step="10" stops size="md" labelStart="Minimum" labelEnd="Maximum" disabled></MdSlider>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider aria-label="Enabled" value="40" size="md"></md-slider>
<md-slider aria-label="Disabled" value="40" size="md" disabled></md-slider>
<md-slider range value-start="20" value-end="70" step="10" stops size="md" label-start="Minimum" label-end="Maximum" disabled></md-slider>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider aria-label="Enabled" value="40" size="md"></md-slider>
<md-slider aria-label="Disabled" value="40" size="md" disabled></md-slider>
<md-slider range value-start="20" value-end="70" step="10" stops size="md" label-start="Minimum" label-end="Maximum" disabled></md-slider>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider aria-label="Enabled" value="40" size="md"></md-slider>
<md-slider aria-label="Disabled" value="40" size="md" disabled></md-slider>
<md-slider range value-start="20" value-end="70" step="10" stops size="md" label-start="Minimum" label-end="Maximum" disabled></md-slider>
</div>controlled stops the slider from keeping the value it was dragged to: you
apply the new value yourself in response to mdInput / mdChange. Without it
the slider writes its own value and keeps it.
The thumb still tracks the pointer during the gesture — the slider holds a live
value internally so the drag feels normal — but on commit it clears that live
state and snaps back to whatever value says.
<md-slider id="zoom" controlled labeled aria-label="Zoom" value="40"></md-slider>
<script type="module">
const zoom = document.getElementById('zoom');
// The thumb tracks the drag, then snaps back to the value prop on
// commit — so the handler has to assign the value it wants kept.
zoom.addEventListener('mdInput', (e) => {
zoom.value = Math.min(70, e.detail.value);
});
</script>import { useState } from 'react';
import { MdSlider } from '@awc-ui/react';
export function CappedZoom() {
const [value, setValue] = useState(40);
return (
<MdSlider
controlled
labeled
aria-label="Zoom"
value={value}
onMdInput={(e) => setValue(Math.min(70, e.detail.value))}
/>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-capped-zoom',
template: `
<md-slider
controlled
labeled
aria-label="Zoom"
[value]="value"
(mdInput)="onInput($event)"
></md-slider>
`,
})
export class CappedZoomComponent {
value = 40;
onInput(e: CustomEvent) {
this.value = Math.min(70, e.detail.value);
}
}<script setup lang="ts">
import { ref } from 'vue';
const value = ref(40);
function onInput(e: CustomEvent) {
value.value = Math.min(70, e.detail.value);
}
</script>
<template>
<md-slider
controlled
labeled
aria-label="Zoom"
:value="value"
@mdInput="onInput"
/>
</template><script lang="ts">
let value = 40;
function onInput(e: CustomEvent) {
value = Math.min(70, e.detail.value);
}
</script>
<md-slider
controlled
labeled
aria-label="Zoom"
value={value}
on:mdInput={onInput}
></md-slider>Two thumbs can meet. valueStart may never exceed valueEnd, so driving the
lower thumb up pushes the upper one rather than overtaking it — the range
stays well-ordered no matter how the user drags.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Both thumbs at 50 — drag either way to separate</div>
<md-slider range value-start="50" value-end="50" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Close together — they meet but never swap</div>
<md-slider range value-start="48" value-end="52" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gap: '28px', inlineSize: '100%', maxInlineSize: '420px' }}>
<div>
<div style={{ font: 'var(--md-sys-typescale-label-medium)', color: 'var(--md-sys-color-on-surface-variant)', marginBlockEnd: '8px' }}>Both thumbs at 50 — drag either way to separate</div>
<MdSlider range valueStart="50" valueEnd="50" valueIndicator labelStart="Minimum" labelEnd="Maximum"></MdSlider>
</div>
<div>
<div style={{ font: 'var(--md-sys-typescale-label-medium)', color: 'var(--md-sys-color-on-surface-variant)', marginBlockEnd: '8px' }}>Close together — they meet but never swap</div>
<MdSlider range valueStart="48" valueEnd="52" valueIndicator labelStart="Minimum" labelEnd="Maximum"></MdSlider>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Both thumbs at 50 — drag either way to separate</div>
<md-slider range value-start="50" value-end="50" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Close together — they meet but never swap</div>
<md-slider range value-start="48" value-end="52" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Both thumbs at 50 — drag either way to separate</div>
<md-slider range value-start="50" value-end="50" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Close together — they meet but never swap</div>
<md-slider range value-start="48" value-end="52" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Both thumbs at 50 — drag either way to separate</div>
<md-slider range value-start="50" value-end="50" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<div>
<div style="font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); margin-block-end: 8px;">Close together — they meet but never swap</div>
<md-slider range value-start="48" value-end="52" value-indicator label-start="Minimum" label-end="Maximum"></md-slider>
</div>
</div>md-slider is form-associated: give it a name and its value goes into
FormData on submit, exactly as a native <input type="range"> does. No hidden
input, no mdChange plumbing of your own.
<form id="prefs">
<md-slider name="volume" value="60" labeled aria-label="Volume"></md-slider>
<md-slider name="price" range value-start="20" value-end="80" labeled
label-start="Minimum price" label-end="Maximum price"></md-slider>
<md-button type="submit" variant="filled">Submit</md-button>
<md-button type="reset" variant="outlined">Reset</md-button>
</form>
<script type="module">
const form = document.getElementById('prefs');
form.addEventListener('submit', (e) => {
e.preventDefault();
const data = new FormData(form);
console.log(data.get('volume'), data.getAll('price')); // "60", ["20", "80"]
});
</script>import { MdSlider, MdButton } from '@awc-ui/react';
export function PreferencesForm() {
function onSubmit(e) {
e.preventDefault();
const data = new FormData(e.currentTarget);
console.log(data.get('volume'), data.getAll('price')); // "60", ["20", "80"]
}
return (
<form onSubmit={onSubmit}>
<MdSlider name="volume" value={60} labeled aria-label="Volume" />
<MdSlider
name="price"
range
valueStart={20}
valueEnd={80}
labeled
ariaLabelStart="Minimum price"
ariaLabelEnd="Maximum price"
/>
<MdButton type="submit" variant="filled">Submit</MdButton>
<MdButton type="reset" variant="outlined">Reset</MdButton>
</form>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-preferences-form',
template: `
<form #prefs (submit)="onSubmit($event, prefs)">
<md-slider name="volume" value="60" labeled aria-label="Volume"></md-slider>
<md-slider name="price" range value-start="20" value-end="80" labeled
label-start="Minimum price" label-end="Maximum price"></md-slider>
<md-button type="submit" variant="filled">Submit</md-button>
<md-button type="reset" variant="outlined">Reset</md-button>
</form>
`,
})
export class PreferencesFormComponent {
onSubmit(e: Event, form: HTMLFormElement) {
e.preventDefault();
const data = new FormData(form);
console.log(data.get('volume'), data.getAll('price')); // "60", ["20", "80"]
}
}<script setup lang="ts">
function onSubmit(e: Event) {
e.preventDefault();
const data = new FormData(e.target as HTMLFormElement);
console.log(data.get('volume'), data.getAll('price')); // "60", ["20", "80"]
}
</script>
<template>
<form @submit="onSubmit">
<md-slider name="volume" value="60" labeled aria-label="Volume" />
<md-slider
name="price"
range
value-start="20"
value-end="80"
labeled
label-start="Minimum price"
label-end="Maximum price"
/>
<md-button type="submit" variant="filled">Submit</md-button>
<md-button type="reset" variant="outlined">Reset</md-button>
</form>
</template><script lang="ts">
function onSubmit(e: Event) {
e.preventDefault();
const data = new FormData(e.target as HTMLFormElement);
console.log(data.get('volume'), data.getAll('price')); // "60", ["20", "80"]
}
</script>
<form on:submit={onSubmit}>
<md-slider name="volume" value="60" labeled aria-label="Volume"></md-slider>
<md-slider name="price" range value-start="20" value-end="80" labeled
label-start="Minimum price" label-end="Maximum price"></md-slider>
<md-button type="submit" variant="filled">Submit</md-button>
<md-button type="reset" variant="outlined">Reset</md-button>
</form>A range slider carries two numbers, which one name can’t express, so it
submits a FormData with one entry per thumb:
| Markup | FormData entries |
|---|---|
<md-slider name="volume"> | volume = 60 |
<md-slider range name="price"> | price = 20, price = 80 — read with formData.getAll('price') |
<md-slider range name-start="from" name-end="to"> | from = 20, to = 80 |
Three behaviours come with it, all matching a native input:
disabled removes the slider from submission entirely.name means nothing is submitted — the slider still works.There is deliberately no constraint validation. A slider always holds a
value inside [min, max], so required would have nothing to catch; use min
and max to bound what the user can pick.
| Event | Cancelable | Detail | Fires |
|---|---|---|---|
mdInput | no | MdSliderValueDetail | Continuously while dragging / on arrow keys |
mdChange | no | MdSliderValueDetail | On commit (drag end, key release) |
mdFocus | no | MdSliderThumbDetail | A thumb gained focus |
mdBlur | no | MdSliderThumbDetail | A thumb lost focus |
mdDragStart | no | MdSliderDragDetail | A drag began |
mdDragEnd | no | MdSliderDragDetail | A drag ended |
thumb discriminatorA single-thumb slider reports value; a range reports valueStart and
valueEnd as well, and the drag/focus events name which thumb moved so one
handler can serve both configurations.
interface MdSliderValueDetail { value: number; // single: the value. Range: see the caution below valueStart?: number; // range only valueEnd?: number; // range only}
interface MdSliderThumbDetail { thumb: 'single' | 'start' | 'end';}
interface MdSliderDragDetail { thumb: 'single' | 'start' | 'end'; value: number; valueStart?: number; valueEnd?: number;}<md-slider id="volume" aria-label="Volume" value="60"
value-indicator value-text="60 percent"></md-slider>
<script type="module">
const s = document.getElementById('volume');
s.addEventListener('mdInput', (e) => preview(e.detail.value)); // continuous
s.addEventListener('mdChange', (e) => save(e.detail.value)); // committed
s.addEventListener('mdDragEnd', (e) => console.log('drag done', e.detail.thumb));
</script>import { MdSlider } from '@awc-ui/react';
export function VolumeSlider() {
return (
<MdSlider
aria-label="Volume"
value={60}
valueIndicator
valueText="60 percent"
onMdInput={(e) => preview(e.detail.value)}
onMdChange={(e) => save(e.detail.value)}
onMdDragEnd={(e) => console.log('drag done', e.detail.thumb)}
/>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-volume-slider',
template: `
<md-slider
aria-label="Volume"
value="60"
value-indicator
value-text="60 percent"
(mdInput)="onInput($event)"
(mdChange)="onChange($event)"
(mdDragEnd)="onDragEnd($event)"
></md-slider>
`,
})
export class VolumeSliderComponent {
onInput(e: CustomEvent) { preview(e.detail.value); }
onChange(e: CustomEvent) { save(e.detail.value); }
onDragEnd(e: CustomEvent) { console.log('drag done', e.detail.thumb); }
}<script setup lang="ts">
function onInput(e: CustomEvent) { preview(e.detail.value); }
function onChange(e: CustomEvent) { save(e.detail.value); }
function onDragEnd(e: CustomEvent) { console.log('drag done', e.detail.thumb); }
</script>
<template>
<md-slider
aria-label="Volume"
value="60"
value-indicator
value-text="60 percent"
@mdInput="onInput"
@mdChange="onChange"
@mdDragEnd="onDragEnd"
/>
</template><script lang="ts">
function onInput(e: CustomEvent) { preview(e.detail.value); }
function onChange(e: CustomEvent) { save(e.detail.value); }
function onDragEnd(e: CustomEvent) { console.log('drag done', e.detail.thumb); }
</script>
<md-slider
aria-label="Volume"
value="60"
value-indicator
value-text="60 percent"
on:mdInput={onInput}
on:mdChange={onChange}
on:mdDragEnd={onDragEnd}
></md-slider>| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
min | min | number | 0 | — |
max | max | number | 100 | — |
value | value | number | 50 | — |
step | step | number | 1 | — |
disabled | disabled | boolean | false | Yes |
name | name | string | '' | Yes |
nameStart | name-start | string | '' | — |
nameEnd | name-end | string | '' | — |
variant | variant | 'standard' | 'centered' | 'standard' | Yes |
range | range | boolean | false | Yes |
stops | stops | boolean | false | Yes |
valueStart | value-start | number | 0 | — |
valueEnd | value-end | number | 100 | — |
size | size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xs' | Yes |
orientation | orientation | 'horizontal' | 'vertical' | 'horizontal' | Yes |
fullHeight | full-height | boolean | false | Yes |
valueIndicator | value-indicator | boolean | false | Yes |
labeled | labeled | boolean | false | Yes |
insetIcon | inset-icon | boolean | false | Yes |
icon | icon | string | '' | — |
sliderAriaLabel | aria-label | string | '' | — |
ariaLabelStart | label-start | string | '' | — |
ariaLabelEnd | label-end | string | '' | — |
valueText | value-text | string | '' | — |
valueStartText | value-start-text | string | '' | — |
valueEndText | value-end-text | string | '' | — |
controlled | controlled | boolean | false | Yes |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
inset-icon | — Custom icon (standard slider only; use with inset-icon) |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-slider-track-length | Vertical track length (block axis) |
--md-slider-active-color | Active track fill |
--md-slider-inactive-color | Inactive track fill |
--md-slider-track-shape | Track border-radius |
--md-slider-track-height | Track cross-axis thickness |
--md-slider-tick-active-color | Stop dot under thumb (hidden) |
--md-slider-tick-filled-color | Stop dots on filled (active) track |
--md-slider-tick-inactive-color | Stop dots on empty (inactive) track |
--md-slider-thumb-color | Thumb knob fill |
--md-slider-thumb-width | Thumb inline size |
--md-slider-thumb-height | Thumb block size |
--md-slider-value-bg | Value indicator background |
--md-slider-value-color | Value indicator text |
--md-slider-value-shape | Value indicator border-radius |
--md-slider-value-font-family | Value indicator font family |
--md-slider-value-font-size | Value indicator font size |
--md-slider-value-font-weight | Value indicator font weight |
--md-slider-value-line-height | Value indicator line height |
--md-slider-value-padding-inline | Value indicator horizontal padding |
--md-slider-value-padding-block | Value indicator vertical padding |
--md-slider-inset-icon-color | Inset icon color (defaults to tick-inactive-color) |
--md-slider-inset-icon-active-color | Inset icon color when over the active track segment |
--md-slider-min-track-length | — |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
surface | Outer container |
track | Track container (clips corners) |
track-inactive | Inactive track segment |
track-active | Active (filled) track segment |
inset | Inset icon area |
thumb-knob | Thumb knob element |
state-layer | State layer overlay |
value-indicator | Value label bubble |
aria-label on the host. Range: name each thumb
with label-start / label-end.value-text (and value-start-text / value-end-text) so the
announcement carries units, not just a number — “50” becomes “50 percent” or
“$1,200”.<input type="range">, so it is focusable, keyboard
driven by the platform, and emits mdFocus / mdBlur. A range slider has two
tab stops, one per thumb.overflow: hidden on a tight wrapper breaks it.| Key | Moves |
|---|---|
← → (↑ ↓ vertical) | one step |
Page Up / Page Down | a larger jump |
Home / End | to min / max |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<md-slider id="sl-kbd" value="40" step="5" stops labeled aria-label="Volume" value-text="40 percent"></md-slider>
<md-slider range value-start="20" value-end="80" step="10" stops labeled label-start="Minimum price" label-end="Maximum price"></md-slider>
<output id="sl-kbd-out" style="font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant);">Tab to a thumb, then use the arrow keys.</output>
</div>
<script type="module">
var sl = document.getElementById('sl-kbd');
var out = document.getElementById('sl-kbd-out');
sl.addEventListener('mdChange', function (e) { out.textContent = 'value = ' + e.detail.value; });
sl.addEventListener('mdFocus', function () { out.textContent = 'Focused — arrows step by 5, Home/End jump to the bounds.'; });
</script>import { useEffect, useRef } from 'react';
import { MdSlider } from '@awc-ui/react';
export function Demo() {
const slRef = useRef(null);
const outRef = useRef(null);
useEffect(() => {
const sl = slRef.current;
const out = outRef.current;
sl.addEventListener('mdChange', function (e) { out.textContent = 'value = ' + e.detail.value; });
sl.addEventListener('mdFocus', function () { out.textContent = 'Focused — arrows step by 5, Home/End jump to the bounds.'; });
}, []);
return (
<>
<div style={{ display: 'grid', gap: '28px', inlineSize: '100%', maxInlineSize: '420px' }}>
<MdSlider id="sl-kbd" ref={slRef} value="40" step="5" stops labeled aria-label="Volume" valueText="40 percent"></MdSlider>
<MdSlider range valueStart="20" valueEnd="80" step="10" stops labeled labelStart="Minimum price" labelEnd="Maximum price"></MdSlider>
<output id="sl-kbd-out" ref={outRef} style={{ font: 'var(--md-sys-typescale-body-small)', color: 'var(--md-sys-color-on-surface-variant)' }}>Tab to a thumb, then use the arrow keys.</output>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
// app.component.ts
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent implements AfterViewInit {
@ViewChild('sl') slRef!: ElementRef;
@ViewChild('out') outRef!: ElementRef;
ngAfterViewInit() {
const sl = this.slRef.nativeElement;
const out = this.outRef.nativeElement;
sl.addEventListener('mdChange', function (e) { out.textContent = 'value = ' + e.detail.value; });
sl.addEventListener('mdFocus', function () { out.textContent = 'Focused — arrows step by 5, Home/End jump to the bounds.'; });
}
}
<!-- app.component.html -->
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<md-slider id="sl-kbd" #sl value="40" step="5" stops labeled aria-label="Volume" value-text="40 percent"></md-slider>
<md-slider range value-start="20" value-end="80" step="10" stops labeled label-start="Minimum price" label-end="Maximum price"></md-slider>
<output id="sl-kbd-out" #out style="font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant);">Tab to a thumb, then use the arrow keys.</output>
</div><script setup>
import { onMounted, ref } from 'vue';
import '@awc-ui/core/define';
const slRef = ref(null);
const outRef = ref(null);
onMounted(() => {
const sl = slRef.value;
const out = outRef.value;
sl.addEventListener('mdChange', function (e) { out.textContent = 'value = ' + e.detail.value; });
sl.addEventListener('mdFocus', function () { out.textContent = 'Focused — arrows step by 5, Home/End jump to the bounds.'; });
});
</script>
<template>
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<md-slider id="sl-kbd" ref="slRef" value="40" step="5" stops labeled aria-label="Volume" value-text="40 percent"></md-slider>
<md-slider range value-start="20" value-end="80" step="10" stops labeled label-start="Minimum price" label-end="Maximum price"></md-slider>
<output id="sl-kbd-out" ref="outRef" style="font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant);">Tab to a thumb, then use the arrow keys.</output>
</div>
</template><script>
import { onMount } from 'svelte';
import '@awc-ui/core/define';
let slRef;
let outRef;
onMount(() => {
const sl = slRef;
const out = outRef;
sl.addEventListener('mdChange', function (e) { out.textContent = 'value = ' + e.detail.value; });
sl.addEventListener('mdFocus', function () { out.textContent = 'Focused — arrows step by 5, Home/End jump to the bounds.'; });
});
</script>
<div style="display: grid; gap: 28px; inline-size: 100%; max-inline-size: 420px;">
<md-slider id="sl-kbd" bind:this={slRef} value="40" step="5" stops labeled aria-label="Volume" value-text="40 percent"></md-slider>
<md-slider range value-start="20" value-end="80" step="10" stops labeled label-start="Minimum price" label-end="Maximum price"></md-slider>
<output id="sl-kbd-out" bind:this={outRef} style="font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant);">Tab to a thumb, then use the arrow keys.</output>
</div>RTL — the track direction and thumb travel mirror under dir="rtl", and the
arrow keys follow reading order. Nothing is re-authored between the two columns
below; only dir changes. See RTL.
<div dir="rtl"> <md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider></div><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:36px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="Volume"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
</div>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', inlineSize: '100%', gridTemplateColumns: 'auto minmax(0,1fr)', gap: '36px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>ltr</span>
<div dir="ltr" style={{ display: 'grid', gap: '28px' }}>
<MdSlider value="35" labeled aria-label="Volume"></MdSlider>
<MdSlider range valueStart="20" valueEnd="70" stops step="10" labelStart="Minimum" labelEnd="Maximum"></MdSlider>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>rtl</span>
<div dir="rtl" style={{ display: 'grid', gap: '28px' }}>
<MdSlider value="35" labeled aria-label="مستوى الصوت"></MdSlider>
<MdSlider range valueStart="20" valueEnd="70" stops step="10" labelStart="الحد الأدنى" labelEnd="الحد الأقصى"></MdSlider>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:36px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="Volume"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:36px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="Volume"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:36px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="Volume"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="Minimum" label-end="Maximum"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:grid;gap:28px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
</div>
</div>There is no mirror-icon on md-slider. The track, the fill and the thumb
travel all flip on their own because the geometry is written with logical
properties — but the glyph you put in the track is just a glyph. A
direction-neutral one (volume_up, graphic_eq) is fine everywhere; a
directional one has to be swapped in your own i18n layer.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:28px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_back" value="40" aria-label="التقدم"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_forward" value="40" aria-label="التقدم"></md-slider>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', inlineSize: '100%', gridTemplateColumns: 'auto minmax(0,1fr)', gap: '28px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>correct</span>
<div dir="rtl" style={{ display: 'grid', gap: '24px' }}>
<MdSlider size="lg" insetIcon icon="volume_up" value="60" aria-label="مستوى الصوت"></MdSlider>
<MdSlider size="lg" insetIcon icon="arrow_back" value="40" aria-label="التقدم"></MdSlider>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>wrong</span>
<div dir="rtl" style={{ display: 'grid', gap: '24px' }}>
<MdSlider size="lg" insetIcon icon="volume_up" value="60" aria-label="مستوى الصوت"></MdSlider>
<MdSlider size="lg" insetIcon icon="arrow_forward" value="40" aria-label="التقدم"></MdSlider>
</div>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:28px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_back" value="40" aria-label="التقدم"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_forward" value="40" aria-label="التقدم"></md-slider>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:28px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_back" value="40" aria-label="التقدم"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_forward" value="40" aria-label="التقدم"></md-slider>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:28px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_back" value="40" aria-label="التقدم"></md-slider>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:grid;gap:24px;">
<md-slider size="lg" inset-icon icon="volume_up" value="60" aria-label="مستوى الصوت"></md-slider>
<md-slider size="lg" inset-icon icon="arrow_forward" value="40" aria-label="التقدم"></md-slider>
</div>
</div>density is a local override of the inherited data-density. All five rungs,
same slider, so the taper of the track and the thumb is visible in one place:
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:24px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-slider density="0" size="md" value="40" step="10" stops aria-label="Density 0"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-slider density="-1" size="md" value="40" step="10" stops aria-label="Density -1"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-slider density="-2" size="md" value="40" step="10" stops aria-label="Density -2"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-slider density="-3" size="md" value="40" step="10" stops aria-label="Density -3"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-slider density="-4" size="md" value="40" step="10" stops aria-label="Density -4"></md-slider>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', inlineSize: '100%', gridTemplateColumns: 'auto minmax(0,1fr)', gap: '24px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>0</span>
<MdSlider density="0" size="md" value="40" step="10" stops aria-label="Density 0"></MdSlider>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-1</span>
<MdSlider density="-1" size="md" value="40" step="10" stops aria-label="Density -1"></MdSlider>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-2</span>
<MdSlider density="-2" size="md" value="40" step="10" stops aria-label="Density -2"></MdSlider>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-3</span>
<MdSlider density="-3" size="md" value="40" step="10" stops aria-label="Density -3"></MdSlider>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-4</span>
<MdSlider density="-4" size="md" value="40" step="10" stops aria-label="Density -4"></MdSlider>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:24px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-slider density="0" size="md" value="40" step="10" stops aria-label="Density 0"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-slider density="-1" size="md" value="40" step="10" stops aria-label="Density -1"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-slider density="-2" size="md" value="40" step="10" stops aria-label="Density -2"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-slider density="-3" size="md" value="40" step="10" stops aria-label="Density -3"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-slider density="-4" size="md" value="40" step="10" stops aria-label="Density -4"></md-slider>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:24px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-slider density="0" size="md" value="40" step="10" stops aria-label="Density 0"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-slider density="-1" size="md" value="40" step="10" stops aria-label="Density -1"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-slider density="-2" size="md" value="40" step="10" stops aria-label="Density -2"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-slider density="-3" size="md" value="40" step="10" stops aria-label="Density -3"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-slider density="-4" size="md" value="40" step="10" stops aria-label="Density -4"></md-slider>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display:grid;inline-size:100%;grid-template-columns:auto minmax(0,1fr);gap:24px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-slider density="0" size="md" value="40" step="10" stops aria-label="Density 0"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-slider density="-1" size="md" value="40" step="10" stops aria-label="Density -1"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-slider density="-2" size="md" value="40" step="10" stops aria-label="Density -2"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-slider density="-3" size="md" value="40" step="10" stops aria-label="Density -3"></md-slider>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-slider density="-4" size="md" value="40" step="10" stops aria-label="Density -4"></md-slider>
</div>The two are independent signals, so they compose without any extra wiring — and a single slider can still override the inherited rung:
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div dir="rtl" data-density="-2" style="display:grid;gap:28px;inline-size:100%;max-inline-size:380px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
<md-slider density="-4" size="md" value="60" aria-label="مكثف"></md-slider>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div dir="rtl" data-density="-2" style={{ display: 'grid', gap: '28px', inlineSize: '100%', maxInlineSize: '380px' }}>
<MdSlider value="35" labeled aria-label="مستوى الصوت"></MdSlider>
<MdSlider range valueStart="20" valueEnd="70" stops step="10" labelStart="الحد الأدنى" labelEnd="الحد الأقصى"></MdSlider>
<MdSlider density="-4" size="md" value="60" aria-label="مكثف"></MdSlider>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div dir="rtl" data-density="-2" style="display:grid;gap:28px;inline-size:100%;max-inline-size:380px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
<md-slider density="-4" size="md" value="60" aria-label="مكثف"></md-slider>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div dir="rtl" data-density="-2" style="display:grid;gap:28px;inline-size:100%;max-inline-size:380px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
<md-slider density="-4" size="md" value="60" aria-label="مكثف"></md-slider>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div dir="rtl" data-density="-2" style="display:grid;gap:28px;inline-size:100%;max-inline-size:380px;">
<md-slider value="35" labeled aria-label="مستوى الصوت"></md-slider>
<md-slider range value-start="20" value-end="70" stops step="10" label-start="الحد الأدنى" label-end="الحد الأقصى"></md-slider>
<md-slider density="-4" size="md" value="60" aria-label="مكثف"></md-slider>
</div>Density — density="-1…-4" locally overrides the inherited data-density
rung (0 means “inherit”); re-check the grab target at every rung you ship. See
Density.
i18n — translate aria-label, label-start, label-end and the *-text
announcements. Format numbers with Intl before putting them into value-text
so “1200” reads as “١٢٠٠” or “1 200” where it should.
| Custom property | Purpose | Default |
|---|---|---|
--md-slider-track-length | Vertical track length (block axis) | 200px |
--md-slider-min-track-length | Floor for a responsive vertical track | 88px |
--md-slider-track-height | Track cross-axis thickness | Per size, tapered by density |
--md-slider-track-shape | Track border-radius | Per size |
--md-slider-active-color | Filled track | primary |
--md-slider-inactive-color | Unfilled track | secondary-container |
--md-slider-tick-active-color | Stop dot under the thumb | primary |
--md-slider-tick-filled-color | Stop dots on the filled track | on-primary |
--md-slider-tick-inactive-color | Stop dots on the empty track | on-secondary-container |
--md-slider-thumb-color | Handle fill | primary |
--md-slider-thumb-width / -thumb-height | Handle box | Per size |
--md-slider-value-bg / -value-color | Value bubble surface / text | inverse-surface / inverse-on-surface |
--md-slider-value-shape | Value bubble radius | shape-corner-full |
--md-slider-value-font-family / -font-size / -font-weight / -line-height | Bubble typography | label-medium |
--md-slider-value-padding-inline / -padding-block | Bubble padding | 16px / 12px |
--md-slider-inset-icon-color | Inset glyph over the empty track | --md-slider-tick-inactive-color |
--md-slider-inset-icon-active-color | Inset glyph over the filled track | --md-slider-tick-filled-color |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Themed" value="65" size="md" value-indicator style="inline-size: 320px; --md-slider-active-color: var(--md-sys-color-tertiary); --md-slider-thumb-color: var(--md-sys-color-tertiary); --md-slider-track-shape: 2px;"></md-slider>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSlider aria-label="Themed" value="65" size="md" valueIndicator style={{ inlineSize: '320px', '--md-slider-active-color': 'var(--md-sys-color-tertiary)', '--md-slider-thumb-color': 'var(--md-sys-color-tertiary)', '--md-slider-track-shape': '2px' }}></MdSlider>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-slider aria-label="Themed" value="65" size="md" value-indicator style="inline-size: 320px; --md-slider-active-color: var(--md-sys-color-tertiary); --md-slider-thumb-color: var(--md-sys-color-tertiary); --md-slider-track-shape: 2px;"></md-slider><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-slider aria-label="Themed" value="65" size="md" value-indicator style="inline-size: 320px; --md-slider-active-color: var(--md-sys-color-tertiary); --md-slider-thumb-color: var(--md-sys-color-tertiary); --md-slider-track-shape: 2px;"></md-slider>
</template><script>
import '@awc-ui/core/define';
</script>
<md-slider aria-label="Themed" value="65" size="md" value-indicator style="inline-size: 320px; --md-slider-active-color: var(--md-sys-color-tertiary); --md-slider-thumb-color: var(--md-sys-color-tertiary); --md-slider-track-shape: 2px;"></md-slider>Every default resolves through an md-sys-color role, so a slider that sets no
custom properties follows the theme on its own:
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider value="40" aria-label="Untouched defaults"></md-slider>
<md-slider value="60" step="10" stops aria-label="With ticks"></md-slider>
<md-slider range value-start="20" value-end="70" label-start="Minimum" label-end="Maximum"></md-slider>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px', inlineSize: '100%', maxInlineSize: '340px' }}>
<MdSlider value="40" aria-label="Untouched defaults"></MdSlider>
<MdSlider value="60" step="10" stops aria-label="With ticks"></MdSlider>
<MdSlider range valueStart="20" valueEnd="70" labelStart="Minimum" labelEnd="Maximum"></MdSlider>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider value="40" aria-label="Untouched defaults"></md-slider>
<md-slider value="60" step="10" stops aria-label="With ticks"></md-slider>
<md-slider range value-start="20" value-end="70" label-start="Minimum" label-end="Maximum"></md-slider>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider value="40" aria-label="Untouched defaults"></md-slider>
<md-slider value="60" step="10" stops aria-label="With ticks"></md-slider>
<md-slider range value-start="20" value-end="70" label-start="Minimum" label-end="Maximum"></md-slider>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider value="40" aria-label="Untouched defaults"></md-slider>
<md-slider value="60" step="10" stops aria-label="With ticks"></md-slider>
<md-slider range value-start="20" value-end="70" label-start="Minimum" label-end="Maximum"></md-slider>
</div>Custom properties cover the palette; the parts reach inside the shadow root for everything else — geometry, gradients, typography of the bubble.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<style>
.parts-slider::part(thumb-knob) { border-radius: 4px; }
.parts-slider::part(track-active) { background: linear-gradient(90deg, var(--md-sys-color-tertiary), var(--md-sys-color-primary)); }
.parts-slider::part(track-inactive) { opacity: .35; }
.parts-slider::part(value-indicator) { font-variant-numeric: tabular-nums; font-weight: 700; }
</style>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider class="parts-slider" value="55" value-indicator aria-label="Styled parts"></md-slider>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.parts-slider::part(thumb-knob) { border-radius: 4px; }
.parts-slider::part(track-active) { background: linear-gradient(90deg, var(--md-sys-color-tertiary), var(--md-sys-color-primary)); }
.parts-slider::part(track-inactive) { opacity: .35; }
.parts-slider::part(value-indicator) { font-variant-numeric: tabular-nums; font-weight: 700; }
</style>
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px', inlineSize: '100%', maxInlineSize: '340px' }}>
<MdSlider className="parts-slider" value="55" valueIndicator aria-label="Styled parts"></MdSlider>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<style>
.parts-slider::part(thumb-knob) { border-radius: 4px; }
.parts-slider::part(track-active) { background: linear-gradient(90deg, var(--md-sys-color-tertiary), var(--md-sys-color-primary)); }
.parts-slider::part(track-inactive) { opacity: .35; }
.parts-slider::part(value-indicator) { font-variant-numeric: tabular-nums; font-weight: 700; }
</style>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider class="parts-slider" value="55" value-indicator aria-label="Styled parts"></md-slider>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<style>
.parts-slider::part(thumb-knob) { border-radius: 4px; }
.parts-slider::part(track-active) { background: linear-gradient(90deg, var(--md-sys-color-tertiary), var(--md-sys-color-primary)); }
.parts-slider::part(track-inactive) { opacity: .35; }
.parts-slider::part(value-indicator) { font-variant-numeric: tabular-nums; font-weight: 700; }
</style>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider class="parts-slider" value="55" value-indicator aria-label="Styled parts"></md-slider>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<style>
.parts-slider::part(thumb-knob) { border-radius: 4px; }
.parts-slider::part(track-active) { background: linear-gradient(90deg, var(--md-sys-color-tertiary), var(--md-sys-color-primary)); }
.parts-slider::part(track-inactive) { opacity: .35; }
.parts-slider::part(value-indicator) { font-variant-numeric: tabular-nums; font-weight: 700; }
</style>
<div style="display:flex;flex-direction:column;gap:20px;inline-size:100%;max-inline-size:340px;">
<md-slider class="parts-slider" value="55" value-indicator aria-label="Styled parts"></md-slider>
</div>Two recipes the parts make easy — a round elevated knob, and a fully themed slider that ignores the palette entirely:
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<style>
.sl-round { --md-slider-thumb-width: 20px; --md-slider-thumb-height: 20px; }
.sl-round::part(thumb-knob) { border-radius: 50%; box-shadow: var(--md-sys-elevation-2, 0 1px 3px rgba(0,0,0,.3)); }
.sl-ocean {
--md-slider-active-color: #0077b6;
--md-slider-inactive-color: #caf0f8;
--md-slider-thumb-color: #0077b6;
--md-slider-thumb-width: 14px;
--md-slider-thumb-height: 14px;
}
.sl-ocean::part(thumb-knob) { border-radius: 50%; box-shadow: 0 0 0 3px #90e0ef, 0 2px 8px rgba(0,119,182,.3); }
.sl-ocean::part(track-active) { background: linear-gradient(90deg, #0077b6, #00b4d8); }
.sl-ocean::part(value-indicator) { background: #023e8a; color: #caf0f8; border-radius: 8px; font-weight: 600; }
</style>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider class="sl-round" value="60" aria-label="Round thumb"></md-slider>
<md-slider class="sl-round" range value-start="25" value-end="75" label-start="Minimum" label-end="Maximum"></md-slider>
<!-- the value bubble is persistent and sits ABOVE the track, outside the
host's box: reserve the room on a wrapper, not on the slider itself -->
<div style="padding-block-start: 32px;">
<md-slider class="sl-ocean" value="45" value-indicator aria-label="Ocean theme"></md-slider>
</div>
</div>import { MdSlider } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.sl-round { --md-slider-thumb-width: 20px; --md-slider-thumb-height: 20px; }
.sl-round::part(thumb-knob) { border-radius: 50%; box-shadow: var(--md-sys-elevation-2, 0 1px 3px rgba(0,0,0,.3)); }
.sl-ocean {
--md-slider-active-color: #0077b6;
--md-slider-inactive-color: #caf0f8;
--md-slider-thumb-color: #0077b6;
--md-slider-thumb-width: 14px;
--md-slider-thumb-height: 14px;
}
.sl-ocean::part(thumb-knob) { border-radius: 50%; box-shadow: 0 0 0 3px #90e0ef, 0 2px 8px rgba(0,119,182,.3); }
.sl-ocean::part(track-active) { background: linear-gradient(90deg, #0077b6, #00b4d8); }
.sl-ocean::part(value-indicator) { background: #023e8a; color: #caf0f8; border-radius: 8px; font-weight: 600; }
</style>
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px', inlineSize: '100%', maxInlineSize: '340px' }}>
<MdSlider className="sl-round" value="60" aria-label="Round thumb"></MdSlider>
<MdSlider className="sl-round" range valueStart="25" valueEnd="75" labelStart="Minimum" labelEnd="Maximum"></MdSlider>
<!-- the value bubble is persistent and sits ABOVE the track, outside the
host's box: reserve the room on a wrapper, not on the slider itself -->
<div style={{ paddingBlockStart: '32px' }}>
<MdSlider className="sl-ocean" value="45" valueIndicator aria-label="Ocean theme"></MdSlider>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<style>
.sl-round { --md-slider-thumb-width: 20px; --md-slider-thumb-height: 20px; }
.sl-round::part(thumb-knob) { border-radius: 50%; box-shadow: var(--md-sys-elevation-2, 0 1px 3px rgba(0,0,0,.3)); }
.sl-ocean {
--md-slider-active-color: #0077b6;
--md-slider-inactive-color: #caf0f8;
--md-slider-thumb-color: #0077b6;
--md-slider-thumb-width: 14px;
--md-slider-thumb-height: 14px;
}
.sl-ocean::part(thumb-knob) { border-radius: 50%; box-shadow: 0 0 0 3px #90e0ef, 0 2px 8px rgba(0,119,182,.3); }
.sl-ocean::part(track-active) { background: linear-gradient(90deg, #0077b6, #00b4d8); }
.sl-ocean::part(value-indicator) { background: #023e8a; color: #caf0f8; border-radius: 8px; font-weight: 600; }
</style>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider class="sl-round" value="60" aria-label="Round thumb"></md-slider>
<md-slider class="sl-round" range value-start="25" value-end="75" label-start="Minimum" label-end="Maximum"></md-slider>
<!-- the value bubble is persistent and sits ABOVE the track, outside the
host's box: reserve the room on a wrapper, not on the slider itself -->
<div style="padding-block-start: 32px;">
<md-slider class="sl-ocean" value="45" value-indicator aria-label="Ocean theme"></md-slider>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<style>
.sl-round { --md-slider-thumb-width: 20px; --md-slider-thumb-height: 20px; }
.sl-round::part(thumb-knob) { border-radius: 50%; box-shadow: var(--md-sys-elevation-2, 0 1px 3px rgba(0,0,0,.3)); }
.sl-ocean {
--md-slider-active-color: #0077b6;
--md-slider-inactive-color: #caf0f8;
--md-slider-thumb-color: #0077b6;
--md-slider-thumb-width: 14px;
--md-slider-thumb-height: 14px;
}
.sl-ocean::part(thumb-knob) { border-radius: 50%; box-shadow: 0 0 0 3px #90e0ef, 0 2px 8px rgba(0,119,182,.3); }
.sl-ocean::part(track-active) { background: linear-gradient(90deg, #0077b6, #00b4d8); }
.sl-ocean::part(value-indicator) { background: #023e8a; color: #caf0f8; border-radius: 8px; font-weight: 600; }
</style>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider class="sl-round" value="60" aria-label="Round thumb"></md-slider>
<md-slider class="sl-round" range value-start="25" value-end="75" label-start="Minimum" label-end="Maximum"></md-slider>
<!-- the value bubble is persistent and sits ABOVE the track, outside the
host's box: reserve the room on a wrapper, not on the slider itself -->
<div style="padding-block-start: 32px;">
<md-slider class="sl-ocean" value="45" value-indicator aria-label="Ocean theme"></md-slider>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<style>
.sl-round { --md-slider-thumb-width: 20px; --md-slider-thumb-height: 20px; }
.sl-round::part(thumb-knob) { border-radius: 50%; box-shadow: var(--md-sys-elevation-2, 0 1px 3px rgba(0,0,0,.3)); }
.sl-ocean {
--md-slider-active-color: #0077b6;
--md-slider-inactive-color: #caf0f8;
--md-slider-thumb-color: #0077b6;
--md-slider-thumb-width: 14px;
--md-slider-thumb-height: 14px;
}
.sl-ocean::part(thumb-knob) { border-radius: 50%; box-shadow: 0 0 0 3px #90e0ef, 0 2px 8px rgba(0,119,182,.3); }
.sl-ocean::part(track-active) { background: linear-gradient(90deg, #0077b6, #00b4d8); }
.sl-ocean::part(value-indicator) { background: #023e8a; color: #caf0f8; border-radius: 8px; font-weight: 600; }
</style>
<div style="display:flex;flex-direction:column;gap:24px;inline-size:100%;max-inline-size:340px;">
<md-slider class="sl-round" value="60" aria-label="Round thumb"></md-slider>
<md-slider class="sl-round" range value-start="25" value-end="75" label-start="Minimum" label-end="Maximum"></md-slider>
<!-- the value bubble is persistent and sits ABOVE the track, outside the
host's box: reserve the room on a wrapper, not on the slider itself -->
<div style="padding-block-start: 32px;">
<md-slider class="sl-ocean" value="45" value-indicator aria-label="Ocean theme"></md-slider>
</div>
</div>CSS parts — surface, track, track-inactive, track-active, inset,
thumb-knob, state-layer, value-indicator. The state-layer element is
exported but ships display: none, so styling it paints nothing — put hover /
focus / press feedback on ::part(thumb-knob) instead.
md-slider::part(thumb-knob) { border-radius: 4px;}md-text-field ·
md-rating ·
md-switch ·
md-segmented-button ·
md-progress-indicator ·
md-color-picker
md-sliderTwo artefacts to give your AI agent so it generates correct UI with this component. The per-component spec answers "how do I use this exact tag?". The main-llm spec answers "which tag should I pick in the first place?".
md-slider spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
System-prompt preamble · decision matrix · token reference · page recipes · anti-patterns. Paste into the system prompt at the start of a piece of work.