Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 1.22 KB

File metadata and controls

61 lines (48 loc) · 1.22 KB

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 Parameter Description
T The type of each side value

Properties

Property Type Description
bottom T The bottom side value
left T The left side value
right T The right side value
top T The top side value