In this article, we are going to see how to add underline to the canvas-like text using FabricJS. The canvas means text written is movable, rotatable, resizable, and can be stretched. But in this article, we will add underline to the text. Further, the text itself cannot be edited like a textbox.
fabric.text(text :string, underline: boolean);
Parameters: This function accepts two parameters as mentioned above and described below:
- text: It specifies the text.
- underline: It specifies whether to add underline or not.
Program: This example uses FabricJS add underline to canvas-like text as given below.\