GitHub

RadialGradient

The <RadialGradient /> element lets authors define radial gradients that can be applied to fill or stroke of graphical elements.

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

const Glow = () => (
  <Svg viewBox="0 0 120 60" width={240} height={120}>
    <Defs>
      <RadialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
        <Stop offset="0" stopColor="#e82200" />
        <Stop offset="1" stopColor="#8d1602" />
      </RadialGradient>
    </Defs>
    <Rect x="8" y="14" width="104" height="32" rx="4" fill="url(#glow)" />
  </Svg>
);
Show preview

Valid props

Prop nameDescriptionTypeDefault
cxDefines the x coordinate of the end circle of the radial gradient.String, Numberundefined
cyDefines the y coordinate of the end circle of the radial gradient.String, Numberundefined
rDefines the radius of the end circle of the radial gradient.String, Numberundefined
frDefines the radius of the start circle of the radial gradient. The gradient will be drawn such that the 0% <Stop> is mapped to the perimeter of the start circle.String, Numberundefined
fxDefines the x coordinate of the start circle of the radial gradient.String, Numberundefined
fyDefines the y coordinate of the start circle of the radial gradient.String, Numberundefined
xlinkHrefReference to another gradient to inherit its stops and attributes from.Stringundefined
gradientTransformDefines a transformation to be applied to the gradient.Stringundefined
gradientUnitsDefines the coordinate system for the gradient attributes. Valid values: "userSpaceOnUse" or "objectBoundingBox"Stringundefined

On this page