diff --git a/packages/uui-color-swatch/lib/uui-color-swatch.element.ts b/packages/uui-color-swatch/lib/uui-color-swatch.element.ts index fa527b0f1..55b1674a4 100644 --- a/packages/uui-color-swatch/lib/uui-color-swatch.element.ts +++ b/packages/uui-color-swatch/lib/uui-color-swatch.element.ts @@ -51,13 +51,23 @@ export class UUIColorSwatchElement extends LabelMixin( private _color?: string; /** - * Determines if the options is disabled. If true the option can't be selected - * + * Sets the swatch to disabled. + * @type {boolean} * @attr + * @default false */ @property({ type: Boolean, reflect: true }) disabled = false; + /** + * Sets the swatch to readonly mode. + * @type {boolean} + * @attr + * @default false + */ + @property({ type: Boolean, reflect: true }) + readonly = false; + /** * When true shows element label below the color checkbox * @@ -82,10 +92,13 @@ export class UUIColorSwatchElement extends LabelMixin( } willUpdate(changedProperties: Map) { - if (changedProperties.has('disabled')) { + if ( + changedProperties.has('disabled') || + changedProperties.has('readonly') + ) { if (this.selectable) { - this.selectable = !this.disabled; - this.deselectable = !this.disabled; + this.selectable = !this.disabled && !this.readonly; + this.deselectable = !this.disabled && !this.readonly; } } if ( @@ -101,7 +114,8 @@ export class UUIColorSwatchElement extends LabelMixin(