Skip to main content

ColorPicker

Use this component if you need to select a color.

boolean
Default: false

Allow user to select an alpha value.

string

ID for the element.

(value: string) => void

The onChange handler will emit the value in hex. If the allowAlpha prop is true, onChange will emit an 8-value hex (#RRGGBBAA). If the allowAlpha prop is false, onChange will emit a 6-value hex (#RRGGBB).

string

The currently selected color.

Supported formats include:

For RGB and RGBA, both the legacy syntax (comma-separated) and modern syntax (space-separate) are supported.

Was this section helpful?

Simple ColorPicker example

import {
render,
ColorPicker,
} from '@shopify/ui-extensions-react/admin';

render('Playground', () => <App />);

function App() {
return (
<ColorPicker
value="rgba(255 0 0 / 0.5)"
onChange={(value) => {
console.log({value});
}}
/>
);
}

Preview