Skip to content

ColorComponent

component

Form input for a color value. Renders a hex text input alongside a native color picker swatch; both stay in sync. The value is a hex color string (e.g. #2A70AC).

Implements ControlValueAccessor so it can be used within Angular forms and Material form fields.

Example :

<mat-form-field>
<mat-label>Primary color</mat-label>
<yuv-color formControlName="primaryColor"></yuv-color>
</mat-form-field>

Selector: yuv-color

Standalone: Yes

Implements: ControlValueAccessor, OnInit, OnDestroy

Type: BooleanInput

Type: string

Type: BooleanInput

Type: unknown

Default Value: new FormControl<string>('#000000', \{ nonNullable: true \})

the color swatch (native <input type="color">, always a full 6-digit hex)

Type: unknown

Default Value: injectNgControl(this)

Type: unknown

Default Value: () => \{...\}

Type: unknown

Default Value: new FormControl<string | null>(null)

the editable hex text input (source of truth for the value)

Type: boolean

Type: string

Type: boolean

Type: unknown

Default Value: new Subject<void>()

Type: string

registerOnChange(fn: function): void
NameTypeDescription
fnfunction
registerOnTouched(): void
setDisabledState(isDisabled: boolean): void
NameTypeDescription
isDisabledboolean
writeValue(value: string): void
NameTypeDescription
valuestring
onContainerClick(event: MouseEvent): void
NameTypeDescription
eventMouseEvent
onFocusIn(): void
onFocusout(): void
onNgOnDestroy(): void
setDescribedByIds(ids: string[]): void
NameTypeDescription
idsstring[]