该页面暂无翻译,已显示英文版本。

Rect<T>

type Rect<T> = { bottom: T; left: T; right: T; top: T; };

Rectangle with left, right, top, and bottom values.

Used for box model properties like margin, padding, border, and inset.

Example

import { Style, type Rect, type LengthPercentage, type LengthPercentageAuto, } from "taffy-layout"; const style = new Style(); // Typed padding const padding: Rect<LengthPercentage> = { left: 10, right: 10, top: 10, bottom: 10, }; // Typed margin with auto const margin: Rect<LengthPercentageAuto> = { left: "auto", right: "auto", top: 10, bottom: 30, }; style.padding = padding; style.margin = margin;

Type Parameters

Type ParameterDescription
TThe type of each side value

Properties

PropertyTypeDescription
bottomTThe bottom side value
leftTThe left side value
rightTThe right side value
topTThe top side value

© 2026 ByteLand Technology Limited