Skip to content

Rectangle

Read as Markdown

import { Rectangle } from "@pibbl/core";

Rectangle uses RectangleProps and RectStyle. It rejects children and accepts local box geometry, fill, stroke, events, cursor, filters, and optional cornerRadius or cornerRadii. Its signed-box rounding uses native Canvas radius scaling and keeps paint and targeting aligned.

<Rectangle
style={{
left: 24,
top: 24,
width: 180,
height: 88,
cornerRadius: 12,
fill: "#2563eb",
}}
/>

Try the Rectangle live example.

Describes a rectangle primitive for JSX or createElement authoring.

Rectangle: PibblPrimitiveComponent<RectangleProps, PrimitiveInput<RectangleProps, RectStyle>>

Related API: Rectangle, PibblPrimitiveComponent, RectangleProps, PrimitiveInput, RectStyle.

  • props — Authored component inputs, supplied through JSX or createElement. See the linked props and style types.

When called directly; Pibbl mounts this component through JSX or createElement.

RectangleProps

RectStyle

View source — packages/core/src/lib/components/rect.ts:96

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

Compile this TSX module with jsx: "react-jsx" and jsxImportSource: "@pibbl/core", then load it from a browser entry point after the document body exists. It creates and mounts one canvas; dispose the controller before removing or replacing that canvas. The interactive study linked below adds controls beyond this minimal use case.

Download source

/** @jsxImportSource @pibbl/core */
import { pibbl, Rectangle } from '@pibbl/core';
const canvas = document.createElement('canvas');
canvas.width = 320;
canvas.height = 240;
document.body.append(canvas);
const controller = pibbl(canvas, (
<Rectangle
style={{
left: 24,
top: 24,
width: 180,
height: 88,
cornerRadius: 12,
fill: "#2563eb",
}}
/>
));
window.addEventListener('pagehide', () => controller.dispose(), { once: true });

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