Skip to main content

Label

new Konva.Label(config)

Label constructor.  Labels are groups that contain a Text and Tag shape

Parameters​

NameTypeDescription
configObject
x (optional)Number
y (optional)Number
width (optional)Number
height (optional)Number
visible (optional)Boolean
listening (optional)Booleanwhether or not the node is listening for events
id (optional)Stringunique id
name (optional)Stringnon-unique name
opacity (optional)Numberdetermines node opacity. Can be any number between 0 and 1
scale (optional)Objectset scale
scaleX (optional)Numberset scale x
scaleY (optional)Numberset scale y
rotation (optional)Numberrotation in degrees
offset (optional)Objectoffset from center point and rotation point
offsetX (optional)Numberset offset x
offsetY (optional)Numberset offset y
draggable (optional)Booleanmakes the node draggable. When stages are draggable, you can drag and drop the entire stage by dragging any portion of the stage
dragDistance (optional)Number
dragBoundFunc (optional)function

Own Methods​

getText()​

get Text shape for the label. You need to access the Text shape in order to update the text properties

Example:

label.getText().fill('red')

getTag()​

get Tag shape for the label. You need to access the Tag shape in order to update the pointer properties and the corner radius