- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/color-picker.json
Modes
You can use multiple modes to build the color picker that fits your needs:
- Input for hex or channel editing
- Popover for area and slider selection
- Swatch picker for preset colors
- Area standalone component for color selection
- Slider for color adjustment
Input
Usage
import { ColorPicker, ColorPickerInput, } from "@/components/ui/color-picker";
<ColorPicker> <ColorPickerInput asChild channel="hex"> <Input /> </ColorPickerInput> </ColorPicker>
Controlled
Use the value and onValueChange props to programmatically control the color picker's state.
#EB5E41
State
Invalid
Disabled
Examples
With Field
Channel Editing
With Swatch
Input with <ColorPickerSwatchPreview /> showing the current color alongside the hex input.
With Popover
An input with trigger and popover content for area, hue, and alpha selection.
Compact
Inspired by Figma's color input.
Popover
Color picker with trigger and popover content.
Usage
import { ColorPicker, ColorPickerArea, ColorPickerAreaThumb, ColorPickerContent, ColorPickerEyeDropperTrigger, ColorPickerSlider, ColorPickerTrigger, ColorPickerTransparencyGrid, ColorPickerView, } from "@/components/ui/color-picker";
<ColorPicker> <ColorPickerTrigger /> <ColorPickerContent> <ColorPickerArea> <ColorPickerAreaThumb /> </ColorPickerArea> <ColorPickerView> <ColorPickerEyeDropperTrigger /> <ColorPickerSlider channel="hue" /> <ColorPickerSlider channel="alpha"> <ColorPickerTransparencyGrid /> </ColorPickerSlider> </ColorPickerView> </ColorPickerContent> </ColorPicker>
State
Disabled
Set disabled to prevent user interaction.
Examples
With Eye Dropper
With Channel Editing
Popover with area, sliders, and input fields for editing red, green, and blue values.
With Only Sliders
Popover with hue, saturation, lightness, and alpha sliders only, no color area.
With Swatch Picker
Popover with preset color swatches for quick selection.
Color Swatch Picker
Usage
import { ColorPicker, ColorPickerSwatchTrigger, ColorPickerSwatchGroup, ColorPickerSwatch, ColorPickerSwatchIndicator, } from "@/components/ui/color-picker";
<ColorPicker> <ColorPickerSwatchGroup> <ColorPickerSwatchTrigger value="#0485F7"> <ColorPickerSwatch value="#0485F7"> <ColorPickerSwatchIndicator /> </ColorPickerSwatch> </ColorPickerSwatchTrigger> </ColorPickerSwatchGroup> </ColorPicker>
Controlled
Use the value and onValueChange props to programmatically control the swatch picker's state.
#0485F7
State
Disabled
Set disabled to prevent user interaction.
Examples
Custom Size
Customize swatch size using the size-* utility class on <ColorPickerSwatchTrigger />.
Custom Radius
Override the default rounded style on <ColorPickerSwatchTrigger /> using the rounded-* utility class.
Custom Indicator
Replace the default check icon with a custom indicator via the children of ColorPickerSwatchIndicator.
Area
Usage
import { ColorPicker, ColorPickerArea, ColorPickerAreaThumb, } from "@/components/ui/color-picker";
<ColorPicker> <ColorPickerArea> <ColorPickerAreaThumb /> </ColorPickerArea> </ColorPicker>
Examples
Color Channels
With Dots
Slider
Usage
import { ColorPicker, ColorPickerSlider, } from "@/components/ui/color-picker";
<ColorPicker> <ColorPickerSlider channel="hue" /> </ColorPicker>
Controlled
rgba(82, 65, 235, 1)
State
Disabled
Examples
Alpha Channel
HSL Channels
HSBA Channels
RGB Channels
Vertical
Custom spacing
Use [--space:--spacing("value")] on <ColorPickerContent /> to adjust popover padding (default --spacing(3)).
API Reference
ColorPicker
Root element of the color picker.
| Prop | Type | Default |
|---|---|---|
value | string | - |
defaultValue | string | - |
onValueChange | (details: ColorPickerValueChangeDetails) => void | - |
disabled | boolean | false |
format | "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba" | "oklch" | - |
inline | boolean | false |
positioning | PositioningOptions | { placement: "top-start" } |
lazyMount | boolean | true |
unmountOnExit | boolean | true |
className | string | - |
ColorPickerTrigger
Button or element that opens the color picker popover.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
ColorPickerContent
Holds the color picker popover. Displayed in a portal.
| Prop | Type | Default |
|---|---|---|
className | string | - |
| Attribute | Default |
|---|---|
--space | --spacing(3) |
ColorPickerControl
Container for grouping control elements such as area, sliders, and inputs.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ColorPickerView
Container for sliders and inputs. Can specify format for child value display.
| Prop | Type | Default |
|---|---|---|
format | "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba" | "oklch" | - |
className | string | - |
ColorPickerArea
Two-dimensional color selection area.
| Prop | Type | Default |
|---|---|---|
showDots | boolean | false |
xChannel | "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha" | - |
yChannel | "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha" | - |
className | string | - |
ColorPickerAreaThumb
Draggable thumb within the color area.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ColorPickerSlider
Slider for adjusting a color channel.
| Prop | Type | Default |
|---|---|---|
channel | "hex" | "hexa" | "red" | "green" | "blue" | "hue" | "saturation" | "brightness" | "lightness" | "alpha" | - |
orientation | "horizontal" | "vertical" | "horizontal" |
className | string | - |
ColorPickerTransparencyGrid
Checkerboard pattern for transparency. Shown as child of ColorPickerSlider when editing alpha.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ColorPickerEyeDropperTrigger
Button that activates the native Eye Dropper API to sample colors from the screen.
| Prop | Type | Default |
|---|---|---|
variant | ButtonProps["variant"] | "outline" |
size | ButtonProps["size"] | "icon-md" |
children | ReactNode | <Pipette /> |
className | string | - |
ColorPickerInput
Input for displaying and editing a color channel value. Use asChild with a custom input.
| Prop | Type | Default |
|---|---|---|
channel | "hex" | "hexa" | "red" | "green" | "blue" | "hue" | "saturation" | "brightness" | "lightness" | "alpha" | "hex" |
asChild | boolean | false |
ColorPickerSwatchPreview
Compact swatch that displays the current color. Use inside an input group for input mode.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ColorPickerSwatchGroup
Container for swatch triggers in swatch picker mode.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ColorPickerSwatchTrigger
Button that selects a color when clicked. Wraps ColorPickerSwatch and optionally ColorPickerSwatchIndicator.
| Prop | Type | Default |
|---|---|---|
value | string | - |
className | string | - |
ColorPickerSwatch
Color swatch display. Use as a child of ColorPickerSwatchTrigger.
| Prop | Type | Default |
|---|---|---|
value | string | - |
className | string | - |
ColorPickerSwatchIndicator
Check mark or custom icon shown when a swatch is selected. Pass children to customize.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | <CheckIcon /> |
className | string | - |
ColorPickerValue
Displays the current color as formatted text.
| Prop | Type | Default |
|---|---|---|
format | "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba" | "oklch" | - |
className | string | - |
ColorPickerValueSwatch
Displays the current color as a swatch. Use for standalone value preview.
| Prop | Type | Default |
|---|---|---|
className | string | - |
parseColor
Exported utility to parse color strings. Use for programmatic color handling.
For the complete list of props and additional subcomponents, see the Ark UI Color Picker documentation.
On This Page