Export mastering
Tune output gain and passband filter before rendering the stem.
GhostSlider is a range input with WAI-ARIA slider semantics. It supports single values and optional two-thumb intervals, native form participation through hidden inputs, and horizontal or vertical orientation. Keyboard support follows the APG Slider pattern (arrows, Page Up/Down, Home, End). Import it from @ghostvue/themes for the track, fill and thumb recipes. To paint the parts yourself, see Advanced: headless composition.
Single, range, and disabled GhostSlider controls with live value readouts.
Tune output gain and passband filter before rendering the stem.
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GhostButton, GhostCard, GhostSlider } from '@ghostvue/themes'
const masterGain = ref(72)
const bandRange = ref<[number, number]>([250, 1400])
const limiter = ref(90)
const status = ref('')
const rangeLabel = computed(
() => `${String(bandRange.value[0])} Hz – ${String(bandRange.value[1])} Hz`,
)
function resetMixer(): void {
masterGain.value = 72
bandRange.value = [250, 1400]
status.value = 'Audio levels reset to defaults.'
}
</script>
<template>
<section class="mixer" aria-labelledby="mixer-title">
<GhostCard>
<template #header>
<div class="mixer__header">
<h2 id="mixer-title" class="mixer__title">Export mastering</h2>
<p class="mixer__lead">
Tune output gain and passband filter before rendering the stem.
</p>
</div>
</template>
<div class="mixer__controls">
<div class="mixer__row">
<div class="mixer__row-head">
<span id="mixer-gain-label" class="mixer__label">
Master output
</span>
<span class="mixer__value">{{ masterGain }}%</span>
</div>
<GhostSlider
v-model="masterGain"
:min="0"
:max="100"
:step="1"
aria-labelledby="mixer-gain-label"
:style="{ inlineSize: '100%' }"
:value-text="`${masterGain} percent`"
@update:model-value="status = ''"
/>
</div>
<div class="mixer__row">
<div class="mixer__row-head">
<!--
aria-valuetext applies to single-thumb sliders only, so the
label carries the unit for both range thumbs.
-->
<span id="mixer-band-label" class="mixer__label">
Passband frequency (Hz)
</span>
<span class="mixer__value">{{ rangeLabel }}</span>
</div>
<GhostSlider
v-model="bandRange"
range
:min="100"
:max="2000"
:step="50"
aria-labelledby="mixer-band-label"
:style="{ inlineSize: '100%' }"
@update:model-value="status = ''"
/>
</div>
<div class="mixer__row">
<div class="mixer__row-head">
<span id="mixer-limiter-label" class="mixer__label">
Safety limiter (locked)
</span>
<span class="mixer__value">{{ limiter }}%</span>
</div>
<GhostSlider
v-model="limiter"
disabled
:min="0"
:max="100"
tone="neutral"
aria-labelledby="mixer-limiter-label"
:style="{ inlineSize: '100%' }"
:value-text="`${limiter} percent`"
/>
</div>
</div>
<template #footer>
<div class="mixer__actions">
<p class="mixer__status" role="status">{{ status }}</p>
<GhostButton
type="button"
variant="ghost"
tone="neutral"
class="mixer__action"
@click="resetMixer"
>
Reset levels
</GhostButton>
</div>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.mixer {
max-inline-size: 34rem;
}
.mixer__header {
display: grid;
gap: var(--ghost-space-gap-xs);
padding-block-end: var(--ghost-space-stack-sm);
}
.mixer__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.mixer__lead,
.mixer__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
overflow-wrap: anywhere;
}
.mixer__controls {
display: grid;
gap: var(--ghost-space-stack-lg);
}
.mixer__row {
display: grid;
gap: var(--ghost-space-gap-sm);
}
.mixer__row-head {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
}
.mixer__label {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.mixer__value {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-snug);
}
.mixer__actions {
display: grid;
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
}
.mixer :deep(.mixer__action) {
inline-size: 100%;
}
@container ghost-demo (min-width: 30rem) {
.mixer__actions {
align-items: center;
display: flex;
justify-content: flex-end;
}
.mixer__status {
flex: 1 1 auto;
}
.mixer :deep(.mixer__action) {
inline-size: auto;
}
}
</style>
The mastering panel composes themed GhostSlider controls from @ghostvue/themes inside GhostCard: a single-thumb gain, a two-thumb passband range, and a disabled limiter, each with a live readout in its unit.
A slider's number means little without its unit. Show the value next to the label, as the readouts above do, and pass value-text so assistive technology hears the same thing: the master output thumb announces "72 percent" through aria-valuetext instead of a bare 72. value-text applies to single-thumb sliders only. In range mode, put the unit in the label instead, as the passband does with "Passband frequency (Hz)".
Two-thumb nightly price range in USD with a live count of matching stays.
5 of 8 stays match
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GhostButton, GhostCard, GhostSlider } from '@ghostvue/themes'
const MIN_PRICE = 40
const MAX_PRICE = 400
const stays = [
{ name: 'Harbor loft', price: 65 },
{ name: 'Garden studio', price: 90 },
{ name: 'Old town flat', price: 120 },
{ name: 'Canal house', price: 155 },
{ name: 'Hillside cabin', price: 180 },
{ name: 'Rooftop suite', price: 240 },
{ name: 'Lakeside villa', price: 320 },
{ name: 'Vineyard estate', price: 395 },
] as const
const price = ref<[number, number]>([80, 240])
const usd = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
maximumFractionDigits: 0,
})
const priceLabel = computed(
() =>
`${usd.format(price.value[0])} – ${usd.format(price.value[1])} per night`,
)
const matches = computed(() =>
stays.filter(
(stay) => stay.price >= price.value[0] && stay.price <= price.value[1],
),
)
const isFullRange = computed(
() => price.value[0] === MIN_PRICE && price.value[1] === MAX_PRICE,
)
function showAnyPrice(): void {
price.value = [MIN_PRICE, MAX_PRICE]
}
</script>
<template>
<section class="price-filter" aria-labelledby="price-filter-title">
<GhostCard>
<template #header>
<h2 id="price-filter-title" class="price-filter__title">
Filter stays
</h2>
</template>
<div class="price-filter__row">
<div class="price-filter__row-head">
<!--
Range thumbs take their names from this label plus "minimum" and
"maximum". aria-valuetext is single-thumb only, so the label
carries the unit and the visible readout spells out the range.
-->
<span id="price-filter-label" class="price-filter__label">
Nightly price (USD)
</span>
<span class="price-filter__value">{{ priceLabel }}</span>
</div>
<!-- The root defaults to 12rem; an inline style object widens it to the card. -->
<GhostSlider
v-model="price"
range
:min="MIN_PRICE"
:max="MAX_PRICE"
:step="10"
name="price-min"
name-max="price-max"
aria-labelledby="price-filter-label"
:style="{ inlineSize: '100%' }"
/>
<div class="price-filter__scale" aria-hidden="true">
<span>{{ usd.format(MIN_PRICE) }}</span>
<span>{{ usd.format(MAX_PRICE) }}</span>
</div>
</div>
<template #footer>
<div class="price-filter__footer">
<p class="price-filter__count" role="status">
{{ matches.length }} of {{ stays.length }} stays match
</p>
<GhostButton
type="button"
variant="ghost"
tone="neutral"
size="sm"
:disabled="isFullRange"
@click="showAnyPrice"
>
Any price
</GhostButton>
</div>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.price-filter {
max-inline-size: 30rem;
}
.price-filter__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.price-filter__row {
display: grid;
gap: var(--ghost-space-gap-sm);
}
.price-filter__row-head,
.price-filter__footer {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
}
.price-filter__label {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.price-filter__value {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-snug);
}
.price-filter__scale {
color: var(--ghost-text-muted);
display: flex;
font-size: var(--ghost-type-size-xs);
font-variant-numeric: tabular-nums;
justify-content: space-between;
line-height: var(--ghost-type-line-snug);
}
.price-filter__count {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
</style>
Enable range and bind v-model to a two-number tuple. Each thumb is its own role="slider" named from the root label plus "minimum" or "maximum", and each keeps the interval valid: the low thumb's aria-valuemax follows the high thumb's value, so the thumbs never cross. Tab to a thumb and use the arrow keys to move it one step, Page Up / Page Down for larger jumps, and Home / End to go as far as the thumb can: End on the low thumb stops at the high thumb. name and nameMax submit both ends with a form.
The themed wrapper adds track, fill, and thumb recipes via size and tone. Track and fill share --ghost-track-thickness-* (4 / 6 / 8px) and the thumb uses --ghost-track-thumb-* (12 / 16 / 20px) at every density and theme. Transparent hit areas grow the track and thumb to at least --ghost-track-target (24px) without changing layout or the focus ring.
Themed vertical orientation and tokens.
Gain 60%
<script setup lang="ts">
import { ref } from 'vue'
import { GhostSlider } from '@ghostvue/themes'
const level = ref(60)
</script>
<template>
<GhostSlider
v-model="level"
orientation="vertical"
aria-label="Channel gain"
:min="0"
:max="100"
:value-text="`${level} percent`"
/>
<!-- Fixed line-height avoids subpixel line-box drift in visual snapshots. -->
<p style="margin: 0; line-height: var(--ghost-font-line-body, 1.25rem)">
Gain {{ level }}%
</p>
</template>
With orientation="vertical", Arrow Up increases the value and Arrow Down decreases it.
A horizontal themed slider fills a GhostField and is 12rem wide elsewhere, such as in a toolbar or a table cell, following the form control width rule. Set inline-size through class or style to choose another width. A vertical slider keeps the headless 12rem height.
Provide an accessible name on the root (aria-label or aria-labelledby). In range mode, each thumb is its own slider with constrained min/max. Arrow keys adjust the focused thumb; RTL flips horizontal arrows. See slider-spec.md for the full contract.
For teams that bring their own design system, the headless GhostSlider from @ghostvue/vue positions the rail, range and thumbs but paints nothing. Each example below carries the consumer CSS it needs, using system colors so it works without a theme.
Headless numeric slider with stepped values.
35 credits
<script setup lang="ts">
import { ref } from 'vue'
import { GhostSlider } from '@ghostvue/vue'
const amount = ref(35)
</script>
<template>
<GhostSlider
v-model="amount"
aria-label="Donation amount slider"
:min="0"
:max="100"
:step="5"
/>
<p>{{ amount }} credits</p>
</template>
<style scoped>
/*
* Headless path ships no visuals; this is consumer CSS for the sample. The
* library positions the rail, range, and thumbs; the sample gives the root a
* box and paints the parts. Parts render inside GhostSlider, so scoped CSS
* needs :deep(). System colors follow light and dark mode without a theme.
*/
.ghost-slider {
block-size: 1.5rem;
inline-size: min(100%, 20rem);
position: relative;
}
.ghost-slider :deep([data-part='rail']) {
background: GrayText;
border-radius: 999px;
}
.ghost-slider :deep([data-part='range']) {
background: Highlight;
border-radius: 999px;
}
.ghost-slider :deep([data-part='thumb']) {
background: Canvas;
block-size: 1.125rem;
border: 2px solid Highlight;
border-radius: 50%;
box-sizing: border-box;
inline-size: 1.125rem;
}
</style>
Two-thumb interval selection for tables.
From 25 to 75
<script setup lang="ts">
import { ref } from 'vue'
import { GhostSlider } from '@ghostvue/vue'
const bounds = ref<readonly [number, number]>([25, 75])
</script>
<template>
<GhostSlider
v-model="bounds"
range
aria-label="Score interval"
:min="0"
:max="100"
:step="5"
/>
<p>From {{ bounds[0] }} to {{ bounds[1] }}</p>
</template>
<style scoped>
/*
* Headless path ships no visuals; this is consumer CSS for the sample. The
* library positions the rail, range, and thumbs; the sample gives the root a
* box and paints the parts. Parts render inside GhostSlider, so scoped CSS
* needs :deep(). System colors follow light and dark mode without a theme.
*/
.ghost-slider {
block-size: 1.5rem;
inline-size: min(100%, 20rem);
position: relative;
}
.ghost-slider :deep([data-part='rail']) {
background: GrayText;
border-radius: 999px;
}
.ghost-slider :deep([data-part='range']) {
background: Highlight;
border-radius: 999px;
}
.ghost-slider :deep([data-part='thumb']) {
background: Canvas;
block-size: 1.125rem;
border: 2px solid Highlight;
border-radius: 50%;
box-sizing: border-box;
inline-size: 1.125rem;
}
</style>
The slider/value-text example on the reference page shows value-text on a headless single-thumb slider.
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | GhostSliderValue | — | Uncontrolled seed and form-reset baseline. |
disabled | boolean | false | Non-operable; hidden inputs not submitted. |
form | string | — | External form association. |
max | number | 100 | Upper bound. |
messages | GhostSliderMessages | — | Overridable range-thumb naming strings (minimum, maximum) and aria-label formatters (formatMinimumLabel, formatMaximumLabel). |
min | number | 0 | Lower bound. |
modelValue | GhostSliderValue | — | Controlled value; tuple when range is true. |
name | string | — | Primary hidden field name. |
nameMax | string | — | High thumb name when range is true. |
orientation | 'horizontal' | 'vertical' | "horizontal" | Axis and keyboard mapping. |
range | boolean | false | Two-thumb interval mode. |
step | number | 1 | Snap increment. |
valueText | string | — | aria-valuetext for single-thumb mode. |
| Slot | Slot props | Description |
|---|---|---|
default | — | Optional inner content. Prefer aria-labelledby or an external label. |
@ghostvue/themes adds these to the headless GhostSlider API, which it forwards:
| Prop | Type | Default | Description |
|---|---|---|---|
tone | 'accent' | 'neutral' | 'danger' | "accent" | Semantic color intent for the range fill and thumb ring. |
size | 'sm' | 'md' | 'lg' | "md" | Track thickness and thumb diameter. |
Native attributes (id, class, aria-labelledby, and listeners) fall through to the root (data-part="root"). Thumbs expose role="slider" with aria-valuenow / aria-valuemin / aria-valuemax.
GhostSliderExposed provides element, value, focus(), and blur().