Skip to main content

Function: rule()

rule(options?: object): ElementDecorator

Decorates an element with an accent rule / divider line or curved bracket.

Parameters​

ParameterTypeDescription
options{ borderStyle?: "solid" | "dashed" | "dotted"; bracket?: number | boolean; className?: string; color?: string | string[]; inset?: number; radius?: string | number; side?: "top" | "left" | "right" | "bottom"; thickness?: string | number; }-
options.borderStyle?"solid" | "dashed" | "dotted"Stroke style following standard CSS border-style (default: "solid").
options.bracket?number | booleanCurves the rule around adjacent corners, creating a stylized bracket / corner-hugging accent. Pass true or an explicit bracket extension length in pixels (default: 10px).
options.className?stringAdditional CSS class name.
options.color?string | string[]Stroke color (single CSS color) or gradient color stops (array of colors).
options.inset?numberInset from both endpoints in stage units (default: 0).
options.radius?string | numberCorner radius for bracket corners or straight line caps in pixels (default: 8 when bracketed, 2 for straight).
options.side?"top" | "left" | "right" | "bottom"Which side the rule sits on or faces ("left"
options.thickness?string | numberRule stroke thickness in canvas pixels or a CSS length (default: 2).

Returns​

ElementDecorator