Skip to content

Color Slider

Free

Change one channel of a color on a 12px gradient track: hue, saturation, lightness, brightness, red, green, blue, or alpha.

  • Base UI
  • React Aria
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Set channel to the part of the color to change. Put a ColorSliderLabel and a ColorSliderOutput above the track.

layer-style.tsx

ColorSlider

PropTypeDefaultDescription
valuestring | Color—The current value (controlled).
defaultValuestring | Color—The default value (uncontrolled).
aria-labelstring—Defines a string value that labels the current element.
aria-labelledbystring—Identifies the element (or elements) that labels the current element.
aria-describedbystring—Identifies the element (or elements) that describes the object.
aria-detailsstring—Identifies the element (or elements) that provide a detailed, extended description for the object.
idstring—The element's unique identifier. See MDN.
namestring—The name of the input element, used when submitting an HTML form. See MDN.
formstring—The <form> element to associate the input with. The value of this attribute must be the id of a <form> in the same document. See MDN.
dirstring—
langstring—
hiddenboolean—
inertboolean—
translate"no""yes"—
suppressHydrationWarningboolean—A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs.
onClickMouseEventHandler<HTMLDivElement>—
onClickCaptureMouseEventHandler<HTMLDivElement>—
onAuxClickMouseEventHandler<HTMLDivElement>—
onAuxClickCaptureMouseEventHandler<HTMLDivElement>—
onContextMenuMouseEventHandler<HTMLDivElement>—
onContextMenuCaptureMouseEventHandler<HTMLDivElement>—
onDoubleClickMouseEventHandler<HTMLDivElement>—
onDoubleClickCaptureMouseEventHandler<HTMLDivElement>—
onMouseDownMouseEventHandler<HTMLDivElement>—
onMouseDownCaptureMouseEventHandler<HTMLDivElement>—
onMouseEnterMouseEventHandler<HTMLDivElement>—
onMouseLeaveMouseEventHandler<HTMLDivElement>—
onMouseMoveMouseEventHandler<HTMLDivElement>—
onMouseMoveCaptureMouseEventHandler<HTMLDivElement>—
onMouseOutMouseEventHandler<HTMLDivElement>—
onMouseOutCaptureMouseEventHandler<HTMLDivElement>—
onMouseOverMouseEventHandler<HTMLDivElement>—
onMouseOverCaptureMouseEventHandler<HTMLDivElement>—
onMouseUpMouseEventHandler<HTMLDivElement>—
onMouseUpCaptureMouseEventHandler<HTMLDivElement>—
onTouchCancelTouchEventHandler<HTMLDivElement>—
onTouchCancelCaptureTouchEventHandler<HTMLDivElement>—
onTouchEndTouchEventHandler<HTMLDivElement>—
onTouchEndCaptureTouchEventHandler<HTMLDivElement>—
onTouchMoveTouchEventHandler<HTMLDivElement>—
onTouchMoveCaptureTouchEventHandler<HTMLDivElement>—
onTouchStartTouchEventHandler<HTMLDivElement>—
onTouchStartCaptureTouchEventHandler<HTMLDivElement>—
onPointerDownPointerEventHandler<HTMLDivElement>—
onPointerDownCapturePointerEventHandler<HTMLDivElement>—
onPointerMovePointerEventHandler<HTMLDivElement>—
onPointerMoveCapturePointerEventHandler<HTMLDivElement>—
onPointerUpPointerEventHandler<HTMLDivElement>—
onPointerUpCapturePointerEventHandler<HTMLDivElement>—
onPointerCancelPointerEventHandler<HTMLDivElement>—
onPointerCancelCapturePointerEventHandler<HTMLDivElement>—
onPointerEnterPointerEventHandler<HTMLDivElement>—
onPointerLeavePointerEventHandler<HTMLDivElement>—
onPointerOverPointerEventHandler<HTMLDivElement>—
onPointerOverCapturePointerEventHandler<HTMLDivElement>—
onPointerOutPointerEventHandler<HTMLDivElement>—
onPointerOutCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onScrollUIEventHandler<HTMLDivElement>—
onScrollCaptureUIEventHandler<HTMLDivElement>—
onWheelWheelEventHandler<HTMLDivElement>—
onWheelCaptureWheelEventHandler<HTMLDivElement>—
onAnimationStartAnimationEventHandler<HTMLDivElement>—
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationEndAnimationEventHandler<HTMLDivElement>—
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationIterationAnimationEventHandler<HTMLDivElement>—
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement>—
onTransitionCancelTransitionEventHandler<HTMLDivElement>—
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionEndTransitionEventHandler<HTMLDivElement>—
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionRunTransitionEventHandler<HTMLDivElement>—
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionStartTransitionEventHandler<HTMLDivElement>—
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement>—
styleStyleOrFunction<ColorSliderRenderProps>—The inline style for the element. A function may be provided to compute the style based on component state.
children—The children of the component. A function may be provided to alter the children based on component state.
slotstring | null—A slot name for the component. Slots allow the component to receive props from a parent component. An explicit null value indicates that the local props completely override all props received from a parent.
render—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
orientation"horizontal""vertical"'horizontal'The orientation of the Slider.
colorSpace"hsb""hsl""rgb"—The color space that the slider operates in. The channel must be in this color space. If not provided, this defaults to the color space of the color or defaultColor value.
channelRequired"alpha""blue""brightness""green""hue""lightness""red""saturation"—The color channel that the slider manipulates.
onChangeEnd—Handler that is called when the user stops dragging.
disabledboolean—Turns off the control: no focus, no edits, and the disabled look.
onValueChange—Runs on each change, with the new value and the Base UI change details.
classNamestring—
trackReactNode—The track under the children. Default: a ColorSliderTrack with one ColorSliderThumb. Pass your own to change a part.

ColorSliderLabel

<div>
PropTypeDefaultDescription
renderDOMRenderFunction<"label", undefined>—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
elementTypestring—
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>.

ColorSliderOutput

PropTypeDefaultDescription
dirstring—
langstring—
hiddenboolean—
inertboolean—
translate"no""yes"—
suppressHydrationWarningboolean—A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs.
onClickMouseEventHandler<HTMLOutputElement>—
onClickCaptureMouseEventHandler<HTMLOutputElement>—
onAuxClickMouseEventHandler<HTMLOutputElement>—
onAuxClickCaptureMouseEventHandler<HTMLOutputElement>—
onContextMenuMouseEventHandler<HTMLOutputElement>—
onContextMenuCaptureMouseEventHandler<HTMLOutputElement>—
onDoubleClickMouseEventHandler<HTMLOutputElement>—
onDoubleClickCaptureMouseEventHandler<HTMLOutputElement>—
onMouseDownMouseEventHandler<HTMLOutputElement>—
onMouseDownCaptureMouseEventHandler<HTMLOutputElement>—
onMouseEnterMouseEventHandler<HTMLOutputElement>—
onMouseLeaveMouseEventHandler<HTMLOutputElement>—
onMouseMoveMouseEventHandler<HTMLOutputElement>—
onMouseMoveCaptureMouseEventHandler<HTMLOutputElement>—
onMouseOutMouseEventHandler<HTMLOutputElement>—
onMouseOutCaptureMouseEventHandler<HTMLOutputElement>—
onMouseOverMouseEventHandler<HTMLOutputElement>—
onMouseOverCaptureMouseEventHandler<HTMLOutputElement>—
onMouseUpMouseEventHandler<HTMLOutputElement>—
onMouseUpCaptureMouseEventHandler<HTMLOutputElement>—
onTouchCancelTouchEventHandler<HTMLOutputElement>—
onTouchCancelCaptureTouchEventHandler<HTMLOutputElement>—
onTouchEndTouchEventHandler<HTMLOutputElement>—
onTouchEndCaptureTouchEventHandler<HTMLOutputElement>—
onTouchMoveTouchEventHandler<HTMLOutputElement>—
onTouchMoveCaptureTouchEventHandler<HTMLOutputElement>—
onTouchStartTouchEventHandler<HTMLOutputElement>—
onTouchStartCaptureTouchEventHandler<HTMLOutputElement>—
onPointerDownPointerEventHandler<HTMLOutputElement>—
onPointerDownCapturePointerEventHandler<HTMLOutputElement>—
onPointerMovePointerEventHandler<HTMLOutputElement>—
onPointerMoveCapturePointerEventHandler<HTMLOutputElement>—
onPointerUpPointerEventHandler<HTMLOutputElement>—
onPointerUpCapturePointerEventHandler<HTMLOutputElement>—
onPointerCancelPointerEventHandler<HTMLOutputElement>—
onPointerCancelCapturePointerEventHandler<HTMLOutputElement>—
onPointerEnterPointerEventHandler<HTMLOutputElement>—
onPointerLeavePointerEventHandler<HTMLOutputElement>—
onPointerOverPointerEventHandler<HTMLOutputElement>—
onPointerOverCapturePointerEventHandler<HTMLOutputElement>—
onPointerOutPointerEventHandler<HTMLOutputElement>—
onPointerOutCapturePointerEventHandler<HTMLOutputElement>—
onGotPointerCapturePointerEventHandler<HTMLOutputElement>—
onGotPointerCaptureCapturePointerEventHandler<HTMLOutputElement>—
onLostPointerCapturePointerEventHandler<HTMLOutputElement>—
onLostPointerCaptureCapturePointerEventHandler<HTMLOutputElement>—
onScrollUIEventHandler<HTMLOutputElement>—
onScrollCaptureUIEventHandler<HTMLOutputElement>—
onWheelWheelEventHandler<HTMLOutputElement>—
onWheelCaptureWheelEventHandler<HTMLOutputElement>—
onAnimationStartAnimationEventHandler<HTMLOutputElement>—
onAnimationStartCaptureAnimationEventHandler<HTMLOutputElement>—
onAnimationEndAnimationEventHandler<HTMLOutputElement>—
onAnimationEndCaptureAnimationEventHandler<HTMLOutputElement>—
onAnimationIterationAnimationEventHandler<HTMLOutputElement>—
onAnimationIterationCaptureAnimationEventHandler<HTMLOutputElement>—
onTransitionCancel—
onTransitionCancelCapture—
onTransitionEnd—
onTransitionEndCapture—
onTransitionRun—
onTransitionRunCapture—
onTransitionStart—
onTransitionStartCapture—
styleStyleOrFunction<SliderRenderProps>—The inline style for the element. A function may be provided to compute the style based on component state.
childrenChildrenOrFunction<SliderRenderProps>—The children of the component. A function may be provided to alter the children based on component state.
render—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
classNamestring—

ColorSliderTrack

PropTypeDefaultDescription
dirstring—
langstring—
hiddenboolean—
inertboolean—
translate"no""yes"—
suppressHydrationWarningboolean—A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs.
onClickMouseEventHandler<HTMLDivElement>—
onClickCaptureMouseEventHandler<HTMLDivElement>—
onAuxClickMouseEventHandler<HTMLDivElement>—
onAuxClickCaptureMouseEventHandler<HTMLDivElement>—
onContextMenuMouseEventHandler<HTMLDivElement>—
onContextMenuCaptureMouseEventHandler<HTMLDivElement>—
onDoubleClickMouseEventHandler<HTMLDivElement>—
onDoubleClickCaptureMouseEventHandler<HTMLDivElement>—
onMouseDownMouseEventHandler<HTMLDivElement>—
onMouseDownCaptureMouseEventHandler<HTMLDivElement>—
onMouseEnterMouseEventHandler<HTMLDivElement>—
onMouseLeaveMouseEventHandler<HTMLDivElement>—
onMouseMoveMouseEventHandler<HTMLDivElement>—
onMouseMoveCaptureMouseEventHandler<HTMLDivElement>—
onMouseOutMouseEventHandler<HTMLDivElement>—
onMouseOutCaptureMouseEventHandler<HTMLDivElement>—
onMouseOverMouseEventHandler<HTMLDivElement>—
onMouseOverCaptureMouseEventHandler<HTMLDivElement>—
onMouseUpMouseEventHandler<HTMLDivElement>—
onMouseUpCaptureMouseEventHandler<HTMLDivElement>—
onTouchCancelTouchEventHandler<HTMLDivElement>—
onTouchCancelCaptureTouchEventHandler<HTMLDivElement>—
onTouchEndTouchEventHandler<HTMLDivElement>—
onTouchEndCaptureTouchEventHandler<HTMLDivElement>—
onTouchMoveTouchEventHandler<HTMLDivElement>—
onTouchMoveCaptureTouchEventHandler<HTMLDivElement>—
onTouchStartTouchEventHandler<HTMLDivElement>—
onTouchStartCaptureTouchEventHandler<HTMLDivElement>—
onPointerDownPointerEventHandler<HTMLDivElement>—
onPointerDownCapturePointerEventHandler<HTMLDivElement>—
onPointerMovePointerEventHandler<HTMLDivElement>—
onPointerMoveCapturePointerEventHandler<HTMLDivElement>—
onPointerUpPointerEventHandler<HTMLDivElement>—
onPointerUpCapturePointerEventHandler<HTMLDivElement>—
onPointerCancelPointerEventHandler<HTMLDivElement>—
onPointerCancelCapturePointerEventHandler<HTMLDivElement>—
onPointerEnterPointerEventHandler<HTMLDivElement>—
onPointerLeavePointerEventHandler<HTMLDivElement>—
onPointerOverPointerEventHandler<HTMLDivElement>—
onPointerOverCapturePointerEventHandler<HTMLDivElement>—
onPointerOutPointerEventHandler<HTMLDivElement>—
onPointerOutCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onScrollUIEventHandler<HTMLDivElement>—
onScrollCaptureUIEventHandler<HTMLDivElement>—
onWheelWheelEventHandler<HTMLDivElement>—
onWheelCaptureWheelEventHandler<HTMLDivElement>—
onAnimationStartAnimationEventHandler<HTMLDivElement>—
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationEndAnimationEventHandler<HTMLDivElement>—
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationIterationAnimationEventHandler<HTMLDivElement>—
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement>—
onTransitionCancelTransitionEventHandler<HTMLDivElement>—
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionEndTransitionEventHandler<HTMLDivElement>—
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionRunTransitionEventHandler<HTMLDivElement>—
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionStartTransitionEventHandler<HTMLDivElement>—
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement>—
onHoverStart—Handler that is called when a hover interaction starts.
onHoverEnd—Handler that is called when a hover interaction ends.
onHoverChange—Handler that is called when the hover state changes.
styleStyleOrFunction<SliderTrackRenderProps>—The inline style for the element. A function may be provided to compute the style based on component state.
children—The children of the component. A function may be provided to alter the children based on component state.
render—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
classNamestring—

ColorSliderThumb

PropTypeDefaultDescription
dirstring—
langstring—
hiddenboolean—
inertboolean—
translate"no""yes"—
suppressHydrationWarningboolean—A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs.
onClickMouseEventHandler<HTMLDivElement>—
onClickCaptureMouseEventHandler<HTMLDivElement>—
onAuxClickMouseEventHandler<HTMLDivElement>—
onAuxClickCaptureMouseEventHandler<HTMLDivElement>—
onContextMenuMouseEventHandler<HTMLDivElement>—
onContextMenuCaptureMouseEventHandler<HTMLDivElement>—
onDoubleClickMouseEventHandler<HTMLDivElement>—
onDoubleClickCaptureMouseEventHandler<HTMLDivElement>—
onMouseDownMouseEventHandler<HTMLDivElement>—
onMouseDownCaptureMouseEventHandler<HTMLDivElement>—
onMouseEnterMouseEventHandler<HTMLDivElement>—
onMouseLeaveMouseEventHandler<HTMLDivElement>—
onMouseMoveMouseEventHandler<HTMLDivElement>—
onMouseMoveCaptureMouseEventHandler<HTMLDivElement>—
onMouseOutMouseEventHandler<HTMLDivElement>—
onMouseOutCaptureMouseEventHandler<HTMLDivElement>—
onMouseOverMouseEventHandler<HTMLDivElement>—
onMouseOverCaptureMouseEventHandler<HTMLDivElement>—
onMouseUpMouseEventHandler<HTMLDivElement>—
onMouseUpCaptureMouseEventHandler<HTMLDivElement>—
onTouchCancelTouchEventHandler<HTMLDivElement>—
onTouchCancelCaptureTouchEventHandler<HTMLDivElement>—
onTouchEndTouchEventHandler<HTMLDivElement>—
onTouchEndCaptureTouchEventHandler<HTMLDivElement>—
onTouchMoveTouchEventHandler<HTMLDivElement>—
onTouchMoveCaptureTouchEventHandler<HTMLDivElement>—
onTouchStartTouchEventHandler<HTMLDivElement>—
onTouchStartCaptureTouchEventHandler<HTMLDivElement>—
onPointerDownPointerEventHandler<HTMLDivElement>—
onPointerDownCapturePointerEventHandler<HTMLDivElement>—
onPointerMovePointerEventHandler<HTMLDivElement>—
onPointerMoveCapturePointerEventHandler<HTMLDivElement>—
onPointerUpPointerEventHandler<HTMLDivElement>—
onPointerUpCapturePointerEventHandler<HTMLDivElement>—
onPointerCancelPointerEventHandler<HTMLDivElement>—
onPointerCancelCapturePointerEventHandler<HTMLDivElement>—
onPointerEnterPointerEventHandler<HTMLDivElement>—
onPointerLeavePointerEventHandler<HTMLDivElement>—
onPointerOverPointerEventHandler<HTMLDivElement>—
onPointerOverCapturePointerEventHandler<HTMLDivElement>—
onPointerOutPointerEventHandler<HTMLDivElement>—
onPointerOutCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onScrollUIEventHandler<HTMLDivElement>—
onScrollCaptureUIEventHandler<HTMLDivElement>—
onWheelWheelEventHandler<HTMLDivElement>—
onWheelCaptureWheelEventHandler<HTMLDivElement>—
onAnimationStartAnimationEventHandler<HTMLDivElement>—
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationEndAnimationEventHandler<HTMLDivElement>—
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationIterationAnimationEventHandler<HTMLDivElement>—
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement>—
onTransitionCancelTransitionEventHandler<HTMLDivElement>—
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionEndTransitionEventHandler<HTMLDivElement>—
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionRunTransitionEventHandler<HTMLDivElement>—
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionStartTransitionEventHandler<HTMLDivElement>—
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement>—
onHoverStart—Handler that is called when a hover interaction starts.
onHoverEnd—Handler that is called when a hover interaction ends.
onHoverChange—Handler that is called when the hover state changes.
styleStyleOrFunction<ColorThumbRenderProps>—The inline style for the element. A function may be provided to compute the style based on component state.
children—The children of the component. A function may be provided to alter the children based on component state.
render—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
classNamestring—
  • Use it to change one channel of a color: hue, alpha, or red.
  • Use orientation="vertical" for a tall panel.
  • Put a ColorSliderLabel and a ColorSliderOutput in the children to show the name and the value.
  • To change two channels at once, use a Color Area.
  • For a value that is not a color, use a Slider.
  • To type the exact number, use a Color Field.
Arrow keysMoves the thumb one step.
Shiftarrow keysMoves the thumb a large step.
Page UporPage DownMoves the thumb a large step.
HomeorEndMoves the thumb to the start or the end.

It is a React Aria Color Slider. The thumb is a native range input, and the arrow keys change the value.

The press area of the track grows to 44px high for a finger.

React Aria reads the direction from I18nProvider locale.

  1. AddedColor Slider.
Open the release