Scripting provides a suite of shape components for creating scalable, vector-based UI elements such as rectangles, circles, capsules, ellipses, and rounded rectangles. These shapes support customizable fill, stroke, trimming, and sizing, making them ideal for dashboards, decorative elements, and interactive visuals.
ShapePropsAll shape components support the following properties for visual customization:
| Property | Type | Description |
|---|---|---|
trim |
{ from: number; to: number } |
Renders only a portion of the shape’s path. Both from and to are fractions between 0.0 and 1.0. |
fill |
ShapeStyle | DynamicShapeStyle |
Fills the shape with a solid color or gradient. |
stroke |
ShapeStyle | DynamicShapeStyle | { shapeStyle, strokeStyle } |
Outlines the shape with a customizable stroke. Supports color, gradient, and stroke style configuration. |
strokeLineWidth |
number (Deprecated) |
Sets the stroke width. Prefer strokeStyle.lineWidth for more control. |
To define the appearance of a shape’s stroke, you can use the strokeStyle object:
| Property | Description |
|---|---|
lineWidth |
Width of the stroke line in points. |
lineCap |
Shape of the endpoints: "butt" (flat), "round" (rounded), or "square" (square-ended). |
lineJoin |
Join style for corners: "miter", "round", or "bevel". |
mitterLimit |
Limit for miter joins. Used when lineJoin is "miter". |
dash |
Array of numbers that define the lengths of painted and unpainted segments. |
dashPhase |
How far into the dash pattern to start the drawing. |
RectangleA basic rectangle.
RoundedRectangleA rectangle with uniformly or dimensionally rounded corners.
UnevenRoundedRectangleA rectangle with individually configurable corner radii.
CircleA circle centered within its frame.
CapsuleAn elongated shape with fully rounded ends.
EllipseAn oval shape fitted inside a rectangular frame.
strokeStyle object.strokeLineWidth property is deprecated and should be replaced with stroke.strokeStyle.lineWidth.trim modifier is particularly useful for animations (e.g., animated drawing of progress rings).frame, padding, and background.