FabricJS Articles

Page 32 of 51

How to set the width of stroke of Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 546 Views

In this tutorial, we are going to learn how to set the width of stroke of a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. The strokeWidth property allows us to specify the width of a stroke for an object in pixels. Syntax new fabric.Rect({ strokeWidth: Number }); Parameters ...

Read More

How to add curves to a Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we are going to learn how to add curves to a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. We can customize a rectangle object by specifying its position, colour, opacity and dimension. However, we can also use properties like rx and ry which allow us to assign the horizontal and vertical border radius of a Rectangle. Syntax new fabric.Rect({ rx : Number, ry: Number }: ...

Read More

How to add dashed stroke to a Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 855 Views

In this tutorial, we are going to learn how to add a dashed stroke to a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. The strokeDashArray property allows us to specify a dash pattern for the object's stroke. Syntax new fabric.Rect({ strokeDashArray: Array }) Parameters Options (optional) − This parameter is an Object which provides additional ...

Read More

How to add shadow to a Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 440 Views

In this tutorial, we are going to learn how to add a shadow to a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. Our rectangle object can be customized in various ways like changing its dimensions, adding a background color, or even adding a shadow to it. We can add a shadow to the rectangle by using the shadow property. Syntax new fabric.Rect({ shadow: fabric.Shadow }) Parameters ...

Read More

How to add stroke to a Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 678 Views

In this tutorial, we are going to learn how to add stroke to a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. Our rectangle object can be customized in various ways like changing its dimensions, adding a background colour or by changing the colour of the line drawn around the object. We can do this by using the stroke property. Syntax new fabric.Rect({ stroke : String }: Object) ...

Read More

How to create a canvas with Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 670 Views

In this tutorial, we are going to learn how to create a canvas with a Rectangle object using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. Syntax new fabric.Rect({ width: Number, height: Number }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations to our rectangle. Using this parameter, properties such as colour, ...

Read More

How to create a Rectangle with background colour using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 548 Views

In this tutorial, we are going to create a Rectangle with background colour using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. The backgroundColor property allows us to assign a colour to our object's background. It is the colour of the container where the rectangle lives and is rectangular in shape for the rectangle. Syntax new fabric.Rect({ backgroundColor: String }: Object) Parameters ...

Read More

How to create a Rectangle with border colour using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 402 Views

In this tutorial, we are going to create a Rectangle with border colour using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. Since FabricJS is extremely flexible, we are allowed to customize our rectangle object in any way we like. One of the properties that FabricJS provides is borderColor which allows us to manipulate the colour of the border when our object is active. Syntax new fabric.Rect({ borderColor: String }: Object) ...

Read More

How to create a Rectangle with crosshair cursor on hover over objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 302 Views

In this tutorial, we are going to create a Rectangle with a crosshair cursor on hover over objects using FabricJS. Crosshair is one of the native cursor styles available which can be used on a FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize, etc., which reuse the native cursor under the hood. The hoverCursor property sets the style of the cursor when hovered over a canvas object. Syntax new fabric.Rect({ hoverCursor: String }: Object) Parameters Options ...

Read More

How to create a Rectangle with help cursor on hover over objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 231 Views

In this tutorial, we are going to create a Rectangle with a help cursor on hover over objects using FabricJS. "help" is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors such as default, all-scroll, crosshair, col-resize, row-resize, etc., that actually reuse the native cursor under the hood. The hoverCursor property sets the style of the cursor when hovered over a canvas object. Syntax new fabric.Rect({ hoverCursor: String }: Object) Parameters ...

Read More
Showing 311–320 of 506 articles
« Prev 1 30 31 32 33 34 51 Next »
Advertisements