SVGText
Text
The <Text /> element draws a graphics element consisting of text.
import { Svg, Text } from '@react-pdf/renderer';
const heading = { fontSize: 16 };
const caption = { fontSize: 9 };
const Label = () => (
<Svg viewBox="0 0 120 60" width={240} height={120}>
<Text x="60" y="28" textAnchor="middle" fill="#3e3e3e" style={heading}>
React-pdf
</Text>
<Text x="60" y="44" textAnchor="middle" fill="#e82200" style={caption}>
draws text inside SVG
</Text>
</Svg>
);Show previewHide preview
Valid props
| Prop name | Description | Type | Default |
|---|---|---|---|
| x | The x coordinate of the starting point of the text baseline. | String, Number | undefined |
| y | The y coordinate of the starting point of the text baseline. | String, Number | undefined |
See also Presentation Attributes