Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
ColorPicker
The ColorPicker component provides a visual interface for merchants to select a color. It displays a color spectrum and outputs the selected color as a hex string. It optionally supports alpha (transparency) selection.
To let merchants type a hex value directly, add a TextField alongside the picker.
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Anchor to PropertiesProperties
Props for the ColorPicker component, which provides a visual interface for the merchant to select a color, with optional alpha (transparency) support.
- Anchor to allowAlphaallowAlphaallowAlphabooleanbooleanDefault: falseDefault: false
Whether to show an alpha (transparency) slider, allowing the merchant to select a color with transparency. When
true, thenemits an 8-character hex string (). Whenfalse, thenemits a 6-character hex string ().- Anchor to idididstringstring
A unique identifier for the color picker. Use this when you need to reference the component programmatically or for form association.
- Anchor to onChangeonChangeonChange(value: string) => void(value: string) => void
A callback fired when the merchant selects a new color. The value is always emitted as a hex string. If
istrue, then the value is an 8-character hex (). Ifisfalse, then the value is a 6-character hex ().- Anchor to valuevaluevaluestringstring
The currently selected color value. Accepts hex, rgb, and rgba strings. Defaults to
rgb(0, 0, 0)if the value is invalid.
Anchor to ExamplesExamples
Anchor to Select product accent colorSelect product accent color
Pick a product accent color from a visual selector and save it. This example uses ColorPicker to capture the selected hex value, with a Button that saves the color.
Select product accent color
 that saves the color.](https://cdn.shopify.com/shopifycloud/shopify-dev/production/assets/assets/images/templated-apis-screenshots/admin-extensions/2025-07/colorpicker-default-CuFrBdEe.png)
Select product accent color
React
import {useState} from 'react';
import {reactExtension, useApi, ColorPicker, Button, BlockStack, Text} from '@shopify/ui-extensions-react/admin';
function App() {
const {data, close} = useApi('admin.product-details.action.render');
const productId = data.selected[0]?.id;
const [color, setColor] = useState('#000000');
return (
<BlockStack>
<Text fontWeight="bold">Product accent color</Text>
<ColorPicker value={color} onChange={setColor} />
<Button
variant="primary"
onPress={async () => {
await fetch('/api/products/accent-color', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, color}),
});
close();
}}
>
Save color
</Button>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.action.render',
() => <App />,
);TS
import {extension, ColorPicker, Button, BlockStack, Text} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.action.render',
(root, api) => {
const {data, close} = api;
const productId = data.selected[0]?.id;
let color = '#000000';
const stack = root.createComponent(BlockStack);
const heading = root.createComponent(
Text,
{fontWeight: 'bold'},
'Product accent color',
);
const picker = root.createComponent(ColorPicker, {
value: color,
onChange: (value) => {
color = value;
},
});
const saveButton = root.createComponent(
Button,
{
variant: 'primary',
onPress: async () => {
await fetch('/api/products/accent-color', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, color}),
});
close();
},
},
'Save color',
);
stack.appendChild(heading);
stack.appendChild(picker);
stack.appendChild(saveButton);
root.appendChild(stack);
},
);Anchor to Enable alpha transparency selectionEnable alpha transparency selection
Enable the alpha (transparency) channel by setting allowAlpha to true. This example lets merchants pick an overlay color with adjustable opacity, returning a hex color string with alpha (for example, #RRGGBBAA) for use on product pages.
Enable alpha transparency selection
React
import {useState} from 'react';
import {reactExtension, ColorPicker, BlockStack, Text} from '@shopify/ui-extensions-react/admin';
function App() {
const [color, setColor] = useState('rgba(0, 0, 0, 0.5)');
return (
<BlockStack>
<Text fontWeight="bold">Overlay color with transparency</Text>
<ColorPicker value={color} allowAlpha onChange={setColor} />
<Text>Selected: {color}</Text>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.block.render',
() => <App />,
);TS
import {extension, ColorPicker, BlockStack, Text} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.block.render',
(root) => {
const stack = root.createComponent(BlockStack);
const heading = root.createComponent(
Text,
{fontWeight: 'bold'},
'Overlay color with transparency',
);
const picker = root.createComponent(ColorPicker, {
value: 'rgba(0, 0, 0, 0.5)',
allowAlpha: true,
onChange: (value) => {
preview.replaceChildren(`Selected: ${value}`);
},
});
const preview = root.createComponent(Text, {}, 'Selected: rgba(0, 0, 0, 0.5)');
stack.appendChild(heading);
stack.appendChild(picker);
stack.appendChild(preview);
root.appendChild(stack);
},
);Anchor to Configure brand color paletteConfigure brand color palette
Present multiple color pickers for a complete brand color configuration. This example renders primary and secondary brand color pickers separated by a Divider, letting merchants define a full product page color scheme.
Configure brand color palette
React
import {useState} from 'react';
import {reactExtension, ColorPicker, Text, Divider, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
const [primary, setPrimary] = useState('#2C6ECB');
const [secondary, setSecondary] = useState('#F4F6F8');
return (
<BlockStack>
<Text fontWeight="bold">Brand colors for product page</Text>
<Text>Primary brand color</Text>
<ColorPicker value={primary} onChange={setPrimary} />
<Divider />
<Text>Secondary brand color</Text>
<ColorPicker value={secondary} onChange={setSecondary} />
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.action.render',
() => <App />,
);TS
import {extension, ColorPicker, Text, Divider, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.action.render',
(root) => {
const stack = root.createComponent(BlockStack);
const heading = root.createComponent(
Text,
{fontWeight: 'bold'},
'Brand colors for product page',
);
const primaryLabel = root.createComponent(Text, {}, 'Primary brand color');
const primaryPicker = root.createComponent(ColorPicker, {
value: '#2C6ECB',
onChange: (color) => console.log('Selected:', color),
});
const divider = root.createComponent(Divider);
const secondaryLabel = root.createComponent(Text, {}, 'Secondary brand color');
const secondaryPicker = root.createComponent(ColorPicker, {
value: '#F4F6F8',
onChange: (color) => console.log('Selected:', color),
});
stack.appendChild(heading);
stack.appendChild(primaryLabel);
stack.appendChild(primaryPicker);
stack.appendChild(divider);
stack.appendChild(secondaryLabel);
stack.appendChild(secondaryPicker);
root.appendChild(stack);
},
);Anchor to Best practicesBest practices
- Show the current color: Display the selected color value near the picker (using a colored Badge, a swatch, or the hex string) so merchants can confirm their choice without relying solely on the picker's visual state.
- Use within a labeled context: ColorPicker doesn't have a built-in label. Pair it with a Heading or Text component to describe what the color selection controls, such as "Background color" or "Accent color".
Anchor to LimitationsLimitations
- ColorPicker doesn't include a text input for manually entering hex values. Merchants can only select colors visually.
- The
valueprop accepts RGB, RGBA, and hex color strings (3, 4, 6, or 8-character hex). Named CSS colors (like "red" or "blue") aren't supported. - The
onChangecallback returns a hex string (#RRGGBB or #RRGGBBAA when alpha is enabled). Other color formats like HSL or RGB tuples aren't returned. - ColorPicker doesn't support preset color swatches or a palette of predefined colors. To offer common color options, build a custom palette using buttons alongside the picker.