Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
One value
Show the value next to the label.
Orders per sync batch
SliderBasic.vue
<script setup lang="ts">
import { ref } from 'vue'
import { Slider } from '@/components/ui/slider'
const batchSize = ref([200])
</script>
<template>
<div class="grid w-full max-w-80 gap-(--bh-space-150)">
<div class="flex items-center justify-between">
<span class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">Orders per sync batch</span>
<output class="text-(--bh-color-text) [font:var(--bh-font-body-default)]">{{ batchSize[0] }}</output>
</div>
<Slider v-model="batchSize" :min="50" :max="500" :step="50" :thumb-labels="['Orders per sync batch']" />
</div>
</template>A range
Two thumbs pick a minimum and a maximum.
Price
SliderRange.vue
<script setup lang="ts">
import { computed, ref } from 'vue'
import { Slider } from '@/components/ui/slider'
const price = ref([20, 80])
const usd = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 })
const label = computed(() => `${usd.format(price.value[0] ?? 0)} to ${usd.format(price.value[1] ?? 0)}`)
</script>
<template>
<div class="grid w-full max-w-80 gap-(--bh-space-150)">
<div class="flex items-center justify-between">
<span class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">Price</span>
<output class="text-(--bh-color-text) [font:var(--bh-font-body-default)]">{{ label }}</output>
</div>
<Slider v-model="price" :min="0" :max="200" :step="5" :min-steps-between-thumbs="1" :thumb-labels="['Lowest price', 'Highest price']" />
</div>
</template>Disabled
The track and range use the disabled colours.
Stock buffer
Turn on stock sync to set a buffer.
SliderDisabled.vue
<script setup lang="ts">
import { Slider } from '@/components/ui/slider'
</script>
<template>
<div class="grid w-full max-w-80 gap-(--bh-space-150)">
<div class="flex items-center justify-between">
<span class="text-(--bh-color-text-disabled) [font:var(--bh-font-label-default)]">Stock buffer</span>
<output class="text-(--bh-color-text-disabled) [font:var(--bh-font-body-default)]">10%</output>
</div>
<Slider :default-value="[10]" :max="50" disabled :thumb-labels="['Stock buffer']" />
<p class="m-0 text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)]">Turn on stock sync to set a buffer.</p>
</div>
</template>