Skip to content

normalizeEdges

Read as Markdown

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

normalizeEdges(value, property, context?) converts an EdgeValues shorthand into Edges. A number applies to all four edges; omitted values become zero. Every edge must be finite and nonnegative, otherwise a LayoutDiagnostic identifies the source property and context.

const padding = normalizeEdges({ top: 8, left: 12 }, "padding");

The accepted types are documented under Layout and styles.

Expands shorthand insets into four validated numeric edges.

normalizeEdges: (value: EdgeValues | undefined, property: string, context?: Readonly<LayoutDiagnosticContext>) => Edges

Related API: normalizeEdges, EdgeValues, LayoutDiagnosticContext, Edges.

  • value — Edge shorthand to expand; undefined uses the empty edge defaults. See EdgeValues .

  • property — Property name used in diagnostics.

  • context — Component and property context for diagnostic messages. See LayoutDiagnosticContext .

Explicit top, right, bottom, and left edge values. See Edges.

EdgeValues

LayoutDiagnosticContext

Edges

View source — packages/core/src/lib/style/normalize.ts:22

Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

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