Skip to content

createRectanglePath

Read as Markdown

import { Clip, createRectanglePath, Rectangle } from "@pibbl/core";

RectanglePathOptions is accepted by createRectanglePath(options): Path2D, which creates a fresh rectangle from numeric width, height, optional position, and optional numeric corner radii. Width and height remain signed, matching Canvas rectangle semantics. It owns no render state.

<Clip
style={{
d: createRectanglePath({
x: 0,
y: 0,
width: 180,
height: 100,
cornerRadius: 12,
}),
}}
>
<Rectangle style={{ width: 180, height: 100, fill: "#2563eb" }} />
</Clip>

Try the Rectangle live example.

Creates a Canvas Path2D for rectangle geometry from validated options.

createRectanglePath: (options: Readonly<RectanglePathOptions>) => Path2D

Related API: createRectanglePath, RectanglePathOptions.

A native Canvas path containing the rectangle.

RectanglePathOptions

View source — packages/core/src/lib/geometry/rectangle.ts:44

Read the Drawing, layout, and effects companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 380919b. ALPHA — NOT FOR PRODUCTION USE.