Represents an edit control for color values.

This control is used to input and edit color values in a user-friendly manner. It can handle various color formats (e.g., RGB, HEX, etc.) and provides a color picker for intuitive color selection. This makes it easier for users to input and adjust color data.

Hierarchy

  • UpTextMainEditControl
    • Color

Accessors

  • get required(): boolean
  • Gets the control's required state.

    Returns boolean

    Example

    var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
    console.log(ctrl.required);
  • set required(value): void
  • Sets the control's required state

    Parameters

    • value: boolean

    Returns void

    Example

    var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
    ctrl.required = false;

Methods

  • Checks the validity of the color input control.

    • If the control is valid, it removes the 'aria-invalid' attribute from the color input element.
    • If the control is not valid, it sets the 'aria-invalid' attribute to 'true'.

    Returns Promise<ValidationInfo>

    A promise that resolves to a ValidationInfo object. The object has an 'isValid' property that indicates whether the control is valid, and a 'message' property that contains a validation message if the control is not valid.

    Example

    const validityResult = await ix.api.dom.getControl("<ELEMENT-GUID>").checkValidity();

    // example of `validityResult` - field is required, but was not filled
    ValidationInfo {
    valStatus: false,
    valMessage: 'Please make a selection',
    valType: 'required'
    }
  • Retrieves the current color value of the control.

    This method returns the current color value of the control as a string in a valid CSS color format (e.g., HEX, RGB, etc.). If the control does not have a color value, it returns an empty string.

    Returns string

    The current color value of the control, or an empty string if no color value is set.

    Example

    // Get the control by its element GUID and retrieve the color value
    const ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
    const value = ctrl.getValue();
    console.log(colorValue); // Outputs the color value to the console
  • Sets a color value for the control.

    This method allows you to programmatically set the color value of the control. The color value should be provided as a string in a valid CSS color format (e.g., HEX, RGB, etc.). If the color value has changed and the yellowFade setting is enabled, the control will visually indicate the change. If the triggerOnchange setting is set to "always" or "strict" and the color value has changed, the control will dispatch a change event.

    Parameters

    • val: string

      The color value to set.

    • Optional settings: {
          triggerOnchange: "disabled" | "strict" | "always";
      }

      Optional settings. Determines when to trigger a 'change' event.

      • triggerOnchange: "disabled" | "strict" | "always"

    Returns void

    Example

    // Get the control by its element GUID and set the color value to white
    var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
    ctrl.setValue("#ffffff", { triggerOnchange: "always" });