Props
X-coordinate of the rectangle’s top-left corner in pixels.
Y-coordinate of the rectangle’s top-left corner in pixels.
Width of the rectangle in pixels.
Height of the rectangle in pixels.
Horizontal corner radius for rounded rectangles in pixels.Use with
ry to create elliptical corners, or alone for circular corners.Vertical corner radius for rounded rectangles in pixels.Use with
rx to create elliptical corners.Usage
Basic Rectangle
Rounded Rectangle
Elliptical Corners
Multiple Rectangles in One Shape
Rectangle with Stroke
Parent-Child Relationships
- Parent: Must be a child of Shape
- Children: Rect does not accept children
The position (
x, y) is relative to the parent Shape’s transform. If the Shape has x={100}, a Rect with x={50} will be rendered at pixel position 150.TypeScript Interface
packages/fiber/src/types.ts:137-167