Back to catalog
Component detail entry
Forms
@vean/ui
SColorSlider

ColorSlider

ColorSlider belongs to the Forms category. Start with demos and usage, then use the API tables to finish integration and styling decisions.

Use the quick jump panel to reach overview, usage, demos, and API first, then continue through the full page.

Quick jump

Related components

If you are composing interactions in the same family, these components usually pair well together.

Color Slider

Overview

A single-channel color slider for hue, alpha, and individual RGB/HSL/HSV/OKLCH channels. SColorSlider combines the Aria ColorSliderRoot/ColorSliderTrack/ColorSliderThumb primitives with the shared sliderVariants style recipe (via sliderVariants).

Use a color slider for a single color channel — typically the hue or alpha channel inside a color picker (paired with color-area).

Usage

Features

  • 🧩 Aria/styled split — ColorSliderCompact composes track + thumb; SColorSlider only injects styles and forwards props/events
  • 🎚️ Single channel — channel picks hue/alpha/saturation/lightness/red/green/blue/… across color spaces
  • 🎨 Color spaces — colorSpace (e.g. hsl, rgb) with format for the emitted string
  • ⌨️ Keyboard — ArrowLeft/Right, PageUp/Down, Home/End adjust the channel; role="slider"
  • ↔️ Orientation — horizontal/vertical via the shared slider primitives
  • 📝 Form field — a hidden input via name for native form submission
  • 🔒 Disabled — disabled disables interaction
  • 📐 6 sizes + colors — xs–2xl size, color accent; per-slot ui overrides

Component family

  • SColorSlider (styled) — the entry wrapper; sliderVariants recipe with dynamic slot forwarding
  • ColorSliderRoot (Aria) — the state owner; modelValue/color, channel/colorSpace/format, value + commit
  • ColorSliderTrack (Aria) — the channel gradient track
  • ColorSliderThumb (Aria) — the draggable position indicator
  • ColorSliderCompact (Aria) — the aggregated composite; composes track + thumb

Demo

Basic

#ec4899d9

API

Aria Layer

5

ColorSlider

20 Props4 Emits
Props
PropTypeDefaultDescription
class
ClassValue
—
Additional class names applied to the root element.
color
ThemeColor
—
Theme color of the component.
size
ThemeSize
—
Visual size of the component.
ui
Partial<ColorSliderUi>
—
Per-slot class overrides for the component.
trackProps
ColorSliderTrackProps
—
Properties forwarded to the track element.
thumbProps
ColorSliderThumbProps
—
Properties forwarded to the thumb element.
modelValue
import("@soybeanjs/colord").AnyColor
—
Current model value.
defaultValue
import("@soybeanjs/colord").AnyColor
—
Default value.
colorSpace
ColorSpace
—
Color space.
channel
ColorChannel
—
Channel.
format
ColorFormat
—
Format.
orientation
DataOrientation
—
Orientation of the component.
dir
Direction
—
Reading direction of the component.
inverted
boolean
—
Whether inverted.
disabled
boolean
—
Whether the component is disabled.
step
number
—
Step.
name
string
—
The name of the field. Submitted with its owning form as part of a name/value pair.
required
boolean
—
When `true`, indicates that the user must set the value before the owning form can be submitted.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`
Emits
Emit NameParametersDescription
update:modelValue
string
Emitted when the model value changes.
update:color
NormalizedColor
Emitted when the color value changes.
change
string
Emitted when change occurs.
changeEnd
string
Emitted when change end occurs.

ColorSliderCompact

16 Props4 Emits
Props
PropTypeDefaultDescription
trackProps
ColorSliderTrackProps
—
Properties forwarded to the track element.
thumbProps
ColorSliderThumbProps
—
Properties forwarded to the thumb element.
modelValue
import("@soybeanjs/colord").AnyColor
—
Current model value.
defaultValue
import("@soybeanjs/colord").AnyColor
—
Default value.
colorSpace
ColorSpace
—
Color space.
channel
ColorChannel
—
Channel.
format
ColorFormat
—
Format.
orientation
DataOrientation
—
Orientation of the component.
dir
Direction
—
Reading direction of the component.
inverted
boolean
—
Whether inverted.
disabled
boolean
—
Whether the component is disabled.
step
number
—
Step.
name
string
—
The name of the field. Submitted with its owning form as part of a name/value pair.
required
boolean
—
When `true`, indicates that the user must set the value before the owning form can be submitted.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`
Emits
Emit NameParametersDescription
update:modelValue
string
Emitted when the model value changes.
update:color
NormalizedColor
Emitted when the color value changes.
change
string
Emitted when change occurs.
changeEnd
string
Emitted when change end occurs.

ColorSliderRoot

14 Props4 Emits
Props
PropTypeDefaultDescription
modelValue
import("@soybeanjs/colord").AnyColor
—
Current model value.
defaultValue
import("@soybeanjs/colord").AnyColor
—
Default value.
colorSpace
ColorSpace
—
Color space.
channel
ColorChannel
—
Channel.
format
ColorFormat
—
Format.
orientation
DataOrientation
—
Orientation of the component.
dir
Direction
—
Reading direction of the component.
inverted
boolean
—
Whether inverted.
disabled
boolean
—
Whether the component is disabled.
step
number
—
Step.
name
string
—
The name of the field. Submitted with its owning form as part of a name/value pair.
required
boolean
—
When `true`, indicates that the user must set the value before the owning form can be submitted.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`
Emits
Emit NameParametersDescription
update:modelValue
string
Emitted when the model value changes.
update:color
NormalizedColor
Emitted when the color value changes.
change
string
Emitted when change occurs.
changeEnd
string
Emitted when change end occurs.

ColorSliderThumb

2 Props
Props
PropTypeDefaultDescription
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

ColorSliderTrack

2 Props
Props
PropTypeDefaultDescription
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

Notes

Architecture and benchmark differences

ColorSliderCompact owns the track/thumb composition while every primitive stays style-free and only the UI wrapper injects the shared sliderVariants classes. This mirrors radix-ui-color/shadcn-ui headless split. Ant Design, Element Plus, Mantine and Naive UI embed the hue/alpha slider inside the color-picker; VeanUI exposes a standalone single-channel slider with color-space/channel control, keyboard interaction, native form input and a size scale.

CapabilityVeanUIshadcn/uiAnt DesignElement PlusMantineNaive UI
Aria/styled split✅✅————
Any channel (hue/alpha…)✅✅————
Multiple color spaces✅✅————
Keyboard interaction✅✅✅✅✅—
Native form input✅✅————
Sizes (6)✅—————

— = unsupported or a different interaction model.

Cautions

  • modelValue accepts a color string or ColorValue; channel selects which channel the slider edits, and format controls the emitted string.
  • channel must be valid for the chosen colorSpace (e.g. hue/alpha in hsl).
  • The component emits update:modelValue, update:color, change and changeEnd; changeEnd fires on pointer/keyboard commit.
  • Provide name to submit the channel as a hidden form field.
  • Use with color-area (saturation plane) inside a color-picker for a complete editor.

Roadmap

N/A — color-slider is feature-complete for the current parity set.

FAQ

How do I use a color slider?

Bind model-value, choose a channel and format:

<SColorSlider v-model:model-value="color" channel="hue" format="hsl" />

How do I edit alpha?

Set channel="alpha":

<SColorSlider v-model:model-value="color" channel="alpha" format="hsl" />

How do I pair it with a color area?

Combine with SColorArea for the saturation plane:

<SColorArea v-model:model-value="color" format="hsl" />
<SColorSlider v-model:model-value="color" channel="hue" format="hsl" />

Changelog

Version history is grouped by release so you can quickly see what changed for this component across published versions.

v0.50.0

2026-10-02

Compare release

Optimization

change default color to primary and update thumb cursor style

Scope: color-sliderAuthors: soybeanjsView commit1047d

Optimization

change default color to primary and update thumb cursor style

Scope: color-sliderAuthors: soybeanjsView commit1047d