Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Vertical with Labels Slider for Svelte

A vertical Level slider at 50, with 100, 75, 50, 25, and 0 beside the track and the reading on the other side.

UI library: Ark UI

100, 75, 50, 25, and 0 run down the left of a vertical track. Level and the number 50 sit on the right.

Use it like a mixer scale, where the marks matter as much as the thumb. A Label and the number are enough if the scale is obvious. In Svelte, Ark UI does not draw those marks.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Slider anatomy: root, label, value, track, range, thumb

Usage

<div class="flex items-center gap-4"><div class="flex h-48 flex-col items-end justify-between text-muted-foreground text-xs tabular-nums">{#each marks as mark (mark)}<span>{mark}</span>{/each}</div><div class="h-48"><Slider aria-label={["Level"]} onValueChange={handleValueChange} orientation="vertical" value={value} /></div><div class="flex flex-col gap-2"><Label>Level</Label><span class="text-muted-foreground text-sm tabular-nums">{value[0]}</span></div></div>

FAQ

How is the scale placed?

A marks array mapped into a h-48 column with justify-between, the same height as the slider, so 100 is at the top and 0 at the bottom.

How does the readout follow the thumb?

The value lives in state, starting at 50, and goes back to the slider as value. The number under the Level label prints it. onValueChange receives details.value, the new array.

How is it made vertical?

orientation="vertical", inside a h-48 box.

How is the slider named?

The Level text is a visible Label, and the slider gets the same name with aria-label, so screen readers announce what it sets. On Ark UI, aria-label is a list with one name per thumb.

What range does it cover?

0 to 100. The scale is plain text, so change both together. min and max set the ends.

Can I move it from the keyboard?

Yes. The thumb takes focus with Tab. The arrow keys move it by one step, Page Up and Page Down by a larger step, and Home and End jump to the ends.

API Reference

Slider

Sets aria-label={["Level"]}, onValueChange={handleValueChange}, orientation="vertical" and value={value}. The rest is on the Slider page.

Label

No extra props in this demo. The rest is on the Label page.