GitHub
SVGRect

Rect

The <Rect /> element is used to create a rectangle and variations of a rectangle shape.

import { Svg, Rect } from '@react-pdf/renderer';

const Swatches = () => (
  <Svg viewBox="0 0 120 60" width={240} height={120}>
    <Rect x="8" y="14" width="32" height="32" rx="4" fill="#e82200" />
    <Rect x="44" y="14" width="32" height="32" rx="4" fill="#8d1602" />
    <Rect x="80" y="14" width="32" height="32" rx="4" fill="#c9c2b6" />
  </Svg>
);
Show preview

Valid props

Prop nameDescriptionTypeDefault
xThe x coordinate of the rect.String, Numberundefined
yThe y coordinate of the rect.String, Numberundefined
widthThe width of the rect.String, Numberundefined
heightThe height of the rect.String, Numberundefined
rxThe horizontal corner radius of the rect.String, Numberundefined
ryThe vertical corner radius of the rect.String, Numberundefined

See also Presentation Attributes

On this page