Skip to main content

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

Parameter

Type

Description

src

string | typeof Field.SKIP_SETUP

The 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).

width

string | number

Width of the image.

height

string | number

Height of the image.

alt

string

(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.

flipRtl

boolean

(Optional) Whether to flip the icon in RTL.

config

FieldImageConfig

(Optional) A map of options used to configure the field. See the field creation documentation for a list of properties this parameter supports.