Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

ColorPicker

ColorPicker accepts hex, rgba, hsla, hsba, and oklch CSS color strings. Its panel includes a color-space area, channel sliders, format tabs, an eyedropper, and an editable copy field. format controls the output string; colorSpace="oklch" keeps palette interaction in native OKLCH channels, so changing the area or sliders does not round-trip through sRGB. defaultFormat sets the initial format when format is uncontrolled. Use formats to limit the copy tabs; the selected format is included automatically.

import { ColorPicker } from '@manti-ui/react';

export default function ColorPickerBasic() {
  return <ColorPicker label="Accent color" defaultValue="#7c3aed" />;
}

Sizes

size sets the trigger's height, padding, type, and swatch. The panel keeps its own canvas; its channel controls use the same size channel as the trigger.

API

PropTypeDefaultDescription
labelReactNodeOptional field label.
valuestringControlled value as a CSS color string.
defaultValuestring'#7c3aed'Initial CSS color value for uncontrolled usage. Hex, rgba, hsla, hsba, and oklch strings are accepted.
formatColorPickerFormat'rgba'Output format used by the trigger, editable value field, selected copy tab, and onValueChange callback.
defaultFormatColorPickerFormat'rgba'Initial output format when format is uncontrolled. The selected format is always included in the copy tabs.
colorSpaceColorSpaceIdColor space used by the interactive palette. `oklch` keeps area and channel changes in native OKLCH values.
formatsreadonly ColorPickerFormat[]['hex', 'rgba', 'hsla']Formats shown in the copy tabs. The selected format is included automatically when it is not in this list.
onFormatChange(format: ColorPickerFormat) => voidCalled when a copy tab changes the selected color format.
onValueChange(value: string) => voidCalled whenever the value changes; emits a CSS color string in the selected format.
showValueTextbooleantrueShow the formatted value text (e.g. rgba(...)) next to the swatch in the trigger. Set to false to show only the color swatch.
size'sm' | 'md' | 'lg''md'Trigger size: height, padding, type, and swatch. The panel receives the same size channel.
placementPlacement'bottom-start'Placement of the panel relative to the control.
disabledbooleanDisable the control.
namestringForm field name for the hidden input.

Styling

Anatomy

PartSelectorDescription
root[data-scope="color-picker"][data-part="root"]The field wrapper.
label[data-scope="color-picker"][data-part="label"]The field label.
trigger[data-scope="color-picker"][data-part="trigger"]The button that opens the picker; shows the current swatch and value.
value-swatch[data-scope="color-picker"][data-part="value-swatch"]The current-color preview chip in the trigger.
positioner[data-scope="color-picker"][data-part="positioner"]Positions the floating panel.
content[data-scope="color-picker"][data-part="content"]The translucent picker panel.
area[data-scope="color-picker"][data-part="area"]The two-dimensional color selection area; in OKLCH, its axes are chroma and lightness.
area-background[data-scope="color-picker"][data-part="area-background"]The hue-tinted backdrop of the area.
area-thumb[data-scope="color-picker"][data-part="area-thumb"]The draggable area handle.
channel-slider[data-scope="color-picker"][data-part="channel-slider"]A color-space channel slider track wrapper.
channel-slider-track[data-scope="color-picker"][data-part="channel-slider-track"]The gradient track of a channel slider.
channel-slider-thumb[data-scope="color-picker"][data-part="channel-slider-thumb"]The draggable channel-slider handle.
transparency-grid[data-scope="color-picker"][data-part="transparency-grid"]The checkerboard behind the alpha slider.
copy-row[data-scope="color-picker"][data-part="copy-row"]Row holding the format tabs (a nested Manti Tabs) and the eyedropper Button; a Manti Clipboard below it shows the color in the selected format.

Tokens

TokenControls
--manti-color-picker-heightheight
--manti-color-picker-padding-xpadding x
--manti-color-picker-swatch-sizeswatch size
--manti-color-picker-panel-widthpanel width
--manti-color-picker-area-heightarea height

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub