Skip to Content

Text

A text rendering component that applies consistent typography. The as prop lets you choose the semantic HTML element, so you can combine accessibility and SEO with flexible styling.

Preview

Display Small

XLarge Semibold

Large Regular

Medium Regular

Small Regular

Examples

As

Specifies the HTML element to render. Visual style and semantics are independent, so you can use any element with any size.

ValueDefaultDescription
pParagraph text
spanInline text
divBlock container
h1` ~ `h6Heading elements
labelForm label
li`, `ul`, `olList elements

Size

Controls the text size. Follows the typography scale defined in design tokens.

ValueDefaultDescription
display-largeLarge hero headings for landing pages
display-mediumPage-level headings
display-smallSection-level headings
xlargeMajor section titles
largeSubheadings, card titles
mediumDefault body text size
smallSecondary text, descriptions
xsmallCaptions, labels, hints

Display Large

Display Medium

Display Small

XLarge

Large

Medium

Small

XSmall

Weight

Controls the font weight.

ValueDefaultCSSDescription
regular400Body and descriptive text
medium500Body text that needs emphasis
semibold600Subheadings, labels
bold700Primary headings, strong emphasis

Regular — 400

Medium — 500

Semibold — 600

Bold — 700

Intent

Controls the color intent of the text.

ValueDefaultDescription
inheritInherits color from the parent element
primaryPrimary content text color
secondarySecondary content text color
successSuccess or completion
warningWarning
dangerError or danger
neutralNeutral color

Inherit

Primary

Success

Warning

Danger

Neutral

Align

Controls text alignment.

ValueDefaultDescription
leftLeft align
centerCenter align
rightRight align

Guidelines

Semantic markup

size controls visual size and as controls the HTML element. They work independently, so you can keep good semantic structure for SEO and accessibility while applying any design.

// Visually large but rendered as h2 <Text as="h2" size="large" weight="semibold">Section title</Text> // Visually small but rendered as label <Text as="label" size="small" weight="medium">Name</Text>

Props

Props

Prop
Default
Type
as?
"p"
"h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "label" | "li" | "ul" | "ol"
size?
"medium"
"xsmall" | "small" | "medium" | "large" | "xlarge" | "display-small" | "display-medium" | "display-large"
weight?
"regular"
"regular" | "medium" | "semibold" | "bold"
intent?
"inherit"
"primary" | "secondary" | "success" | "warning" | "danger" | "neutral" | "inherit"
align?
"left"
"left" | "center" | "right"
truncate?
false
boolean
children?
ReactNode
Last updated on