Shopware Design

Colorpicker

Source

Usage

Colorpicker is a form field for choosing and editing a color value. Use it when users need to define a custom brand, accent, or interface color and a text input alone would make color editing harder or more error-prone. Use the alpha option when transparency is part of the value users need to control.

import { MtColorpicker } from "@shopware-ag/meteor-component-library";

Examples

Without alpha

API reference

Props

PropTypeDefault
error
An error in your business logic related to this field.
Record<string, any>null
label
A label for your text field. Usually used to guide the user what value this field controls.
stringnull
required
Determines if the field is required.
booleanfalse
is-inheritance-field
Determines if the field is inheritable.
booleanfalse
is-inherited
Toggles the inheritance visualization.
booleanfalse
help-text
A text that helps the user to understand what this field does.
stringnull
disabled
Determines if the field is disabled.
booleanfalse
namestringnull
model-value
The value of the colorpicker field.
string | null""
disable-inheritance-toggle
Determines the active state of the inheritance toggle.
booleanfalse
z-indexnumber | nullnull
readonly
Determines if the field can be edited
booleanfalse
color-output
Change the output value which gets emitted and shown in the field.
"auto" | "hex" | "hsl" | "rgb""auto"
alpha
If activated then the color value can contain alpha values
booleantrue
color-labels
Toggle the labels above each field inside the colorpicker
booleantrue
compact
Show the colorpicker in a compact mode
booleanfalse
apply-mode
Use apply-mode to apply the color value on button click
booleanfalse
placeholderstring
on-update:model-value((...args: any[]) => any) | undefined
on-inheritance-remove((...args: any[]) => any) | undefined
on-inheritance-restore((...args: any[]) => any) | undefined

Exposed

NameType
tComposerTranslation<{ en: { "mt-colorpicker": { apply: string; }; }; de: { "mt-colorpicker": { apply: string; }; }; }, "en" | "de", RemoveIndexSignature<{ [x: string]: LocaleMessageValue<VueMessageType>; }>, never, "mt-colorpicker" | "mt-colorpicker.apply", "mt-colorpicker" | "mt-colorpicker.apply">
localValuestring | { string: string; red: string; green: string; blue: string; alpha?: string | undefined; }
visibleboolean
isDraggingboolean
userInputnull
luminanceValuenumber
saturationValuenumber
hueValuenumber
alphaValuenumber
hasFocusboolean
trap{ active: boolean; paused: boolean; activate: (activateOptions?: ActivateOptions | undefined) => FocusTrap; deactivate: (deactivateOptions?: DeactivateOptions | undefined) => FocusTrap; pause: (pauseOptions?: PauseOptions | undefined) => FocusTrap; unpause: (unpauseOptions?: UnpauseOptions | undefined) => FocusTrap; updateContainerElements: (containerElements: string | HTMLElement | SVGElement | (string | HTMLElement | SVGElement)[]) => FocusTrap; } | null
hueStepnumber
alphaStepnumber
colorValuestring | { string: string; red: string; green: string; blue: string; alpha?: string | undefined; }
integerAlphanumber
sliderBackgroundstring
isColorValidboolean
previewColorValuestring
selectorBackgroundstring
redValuenumber
greenValuenumber
blueValuenumber
rgbValuestring
hslValuestring
hexValuestring | { string: string; red: string; green: string; blue: string; alpha?: string | undefined; }
convertedValuestring | { string: string; red: string; green: string; blue: string; alpha?: string | undefined; }
selectorPositionXstring
selectorPositionYstring
selectorStyles{ backgroundColor: string; top: string; left: string; }
componentClasses{ "mt-colorpicker": boolean; "mt-colorpicker--compact": boolean; }

Best practices

Do
  • Use a clear label so users understand what surface or token the color affects.
  • Keep the emitted format consistent with the value your feature expects.
  • Enable alpha only when transparency is actually supported by the consuming feature.
Don't
  • Do not use Colorpicker when users only need to choose from a small fixed palette.
  • Do not enable alpha if the saved value ignores transparency.
  • Do not rely on color alone to explain what a setting changes.

Behavior

  • Colorpicker supports different emitted output formats through colorOutput, such as auto, hex, hsl, and rgb.
  • When alpha is enabled, the picker also exposes transparency controls and can emit values with opacity.
  • helpText, required, error, and inheritance-related props integrate with the shared field wrapper.

Accessibility

  • Always provide a visible label so users understand what the chosen color controls.
  • Do not rely only on the visual preview. The text value should remain understandable and editable.
  • If alpha is enabled, make sure nearby context explains how transparency affects the result.