Skip to content

Line

Read as Markdown

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

Line uses LineProps and LineStyle. Its numeric coordinate pairs define an ordered polyline; it rejects children. Stroke targeting uses lineInteractionWidth when supplied. Coordinates must be finite logical Canvas units.

<Line
style={{
coords: [
[12, 72],
[64, 20],
[128, 72],
],
stroke: "#1d4ed8",
strokeWidth: 5,
}}
/>

Try the Line live example.

Describes a polyline primitive for JSX or createElement authoring.

Line: PibblPrimitiveComponent<LineProps, PrimitiveInput<LineProps, LineStyle>>

Related API: Line, PibblPrimitiveComponent, LineProps, PrimitiveInput, LineStyle.

  • 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.

LineProps

LineStyle

View source — packages/core/src/lib/components/line.ts:108

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, Line } from '@pibbl/core';
const canvas = document.createElement('canvas');
canvas.width = 320;
canvas.height = 240;
document.body.append(canvas);
const controller = pibbl(canvas, (
<Line
style={{
coords: [
[12, 72],
[64, 20],
[128, 72],
],
stroke: "#1d4ed8",
strokeWidth: 5,
}}
/>
));
window.addEventListener('pagehide', () => controller.dispose(), { once: true });

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