Skip to content
aq-ui
Back to ComponentsComponent

Color Picker

Accessible color area, hue and alpha controls, swatch, field, and controlled color formats.

Preview

This is a live example. Interact with the available controls and use the keyboard to inspect the component's states and behavior.

Loading interactive preview…

Installation

pnpm dlx aq-ui@alpha add color-picker

API reference

Client module

Import the parts you need, then jump to an export for its contract.

View full source

Quick start

"use client"

import { ColorPicker } from "@/components/ui/color-picker"

<ColorPicker />

ColorPicker

constSource L42

Accessible color area, hue and alpha controls, swatch, field, and controlled color formats.

const ColorPicker = React.forwardRef<HTMLDivElement, ColorPickerProps>(…)
<ColorPicker />

ColorPickerProps

interfaceSource L27

Type contract for ColorPickerProps.

interface ColorPickerProps extends Omit< React.ComponentPropsWithoutRef<"div">, "defaultValue" | "onChange" >

Members

NameTypeDefault
value?string—
defaultValue?string"#3b82f6"
onValueChange?(value: string, color: Color) => void—
format?SupportedColorFormat"hex"
showAlpha?booleanfalse
disabled?boolean—
label?React.ReactNode"Color"
className?string—
name?string—

SupportedColorFormat

typeSource L22

Type contract for SupportedColorFormat.

type SupportedColorFormat = Extract<ColorFormat, "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba">

Registry dependencies

utils

Package dependencies

react-aria-components@^1.12.3

Files

  • components/ui/color-picker.tsx

Source