Single-style text is self-closing with a value attribute. Mixed-style text has <segment> children — each segment overrides font attrs for its run.
text
tagtext nodeSingle-style text is self-closing with a value attribute. Mixed-style text has <segment> children — each segment overrides font attrs for its run.
text-style references a named style; individual font attrs are omitted when a style is referenced. Variable fonts use font-variation; OpenType features use font-feature.
| Attr | Type | Description |
|---|---|---|
name | string | |
value required | string | |
x | number | |
y | number | |
w | number | 'fill' | w absent = hug text content |
h | number | 'fill' | h absent = hug text content |
text-style | string | |
fill-style | string | |
font-family | string | |
font-postscript | string | |
font-style-name | string | |
font-size | number | |
font-weight | number | |
font-style | normal italic | |
font-variation | string | |
font-feature | string | |
fill | color | token | |
line-height | number | string | |
letter-spacing | number | string | |
baseline-shift | number | |
paragraph-spacing | number | |
paragraph-indent | number | |
align | left right center justified | |
vertical-align | center top bottom | |
decoration | underline strikethrough | |
decoration-color | color | |
decoration-style | solid dashed dotted wavy double | |
decoration-thickness | number | |
text-case | uppercase lowercase capitalize small-caps small-caps-forced | |
leading-trim | normal cap-height | |
text-resize | hug hug-height fixed truncate | |
truncate | boolean | |
max-lines | number | |
overflow | clip ellipsis | |
list | disc decimal none | |
list-level | number | |
list-marker | string | |
href | string | |
font-stretch | normal ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded | |
direction | ltr rtl | |
writing-mode | horizontal-tb vertical-rl vertical-lr | |
white-space | normal nowrap pre pre-wrap pre-line | |
word-break | normal break-all keep-all break-word | |
word-spacing | number | |
text-underline-offset | number | |
text-decoration-skip-ink | boolean | |
text-wrap | wrap nowrap balance pretty stable | |
font-optical-sizing | auto none | |
font-smoothing | auto none antialiased subpixel-antialiased | |
text-rendering | auto optimizeSpeed optimizeLegibility geometricPrecision |
Single, mixed, decorated
<text value="Welcome back" font-family="Inter" font-size="22" font-weight="700" fill="#1C1C1E" /> <text x="24" y="80" w="300"> <segment value="Pay " fill="#6E6E73" font-size="16" /> <segment value="$42.00" fill="#1C1C1E" font-size="16" font-weight="700" /> </text>