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