Skip to content

Text

Renders a single text node as any semantic HTML element. Uses design tokens for size, weight, and color so text always respects the consumer’s theme.

Terminal window
npx @a2ra/cli add text
{
"type": "Text",
"props": {
"as": "h2",
"size": "xl",
"weight": "semibold",
"color": "default"
},
"children": "Account settings"
}
PropTypeDescription
asp default
h1
h2
h3
h4
span
label
HTML element to render
sizexs
sm
md default
lg
xl
2xl
Font size
weightnormal default
medium
semibold
bold
Font weight
colordefault default
muted
primary
danger
Text color token
alignleft default
center
right
justify
Text alignment
italictrue
false default
Italic style
truncatetrue
false default
Single-line truncation with ellipsis
childrenstring
node[]
Text content
  • Use as to choose the right semantic element. All font size and weight values are independent of the element, so as: "h2" does not automatically make the text large.
  • truncate: true adds overflow-hidden text-ellipsis whitespace-nowrap and requires a fixed or constrained width on the parent to take effect.