Skip to main content

Home > blockly > FieldImage > (constructor)

FieldImage.(constructor)

Constructs a new instance of the FieldImage class

Signature:

constructor(src: string | typeof Field.SKIP_SETUP, width: string | number, height: string | number, alt?: string, onClick?: (p1: FieldImage) => void, flipRtl?: boolean, config?: FieldImageConfig);

Parameters

ParameterTypeDescription
srcstring | typeof Field.SKIP_SETUPThe URL of the image. Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by subclasses that want to handle configuration and setting the field value after their own constructors have run).
widthstring | numberWidth of the image.
heightstring | numberHeight of the image.
altstring(Optional) Optional alt text for when block is collapsed.
onClick(p1: FieldImage) => void(Optional) Optional function to be called when the image is clicked. If onClick is defined, alt must also be defined.
flipRtlboolean(Optional) Whether to flip the icon in RTL.
configFieldImageConfig(Optional) A map of options used to configure the field. See the field creation documentation for a list of properties this parameter supports.