Display text with semantic elements, font sizes, colours, and font weights.

<Text as="h2" size="xl" color="primary" weight="bold">
  Make yourself clear
</Text>

Anatomy

<Text />

Examples

Semantic elements

as defaults to p. It accepts p, span, div, h1 through h6, strong, em, small, s, b, i, u, mark, sub, and sup. Native attributes, events, and refs follow the selected element.

Choose the element for its meaning. Use size and weight to control its appearance; when omitted, font size and weight follow your existing styles and browser defaults.

Section heading

A paragraph with important text.

<Flex direction="column" gap="3">
  <Text as="h2" size="xl" weight="bold">
    Section heading
  </Text>
  <Text>
    A paragraph with{" "}
    <Text as="strong" weight="semibold">
      important text
    </Text>
    .
  </Text>
</Flex>

Sizes

size accepts xs (12px), sm (14px), md (16px), lg (18px), and xl (20px), or a custom CSS font size such as 2rem or clamp(1rem, 3vw, 2rem).

Extra small

Small

Medium

Large

Extra large

Custom size

<Flex direction="column" gap="2">
  <Text size="xs">Extra small</Text>
  <Text size="sm">Small</Text>
  <Text size="md">Medium</Text>
  <Text size="lg">Large</Text>
  <Text size="xl">Extra large</Text>
  <Text size="2rem">Custom size</Text>
</Flex>

Colours

Use the existing color prop with a theme colour, hex value, RGB function, or raw RGB channels. See the colour property for the full palette.

Primary colour

Success colour

Custom hex colour

Custom RGB colour

<Flex direction="column" gap="2">
  <Text color="primary">Primary colour</Text>
  <Text color="success">Success colour</Text>
  <Text color="#34baeb">Custom hex colour</Text>
  <Text color="rgb(235, 52, 226)">Custom RGB colour</Text>
</Flex>

Font weights

weight accepts thin (100), extralight (200), light (300), normal (400), medium (500), semibold (600), bold (700), extrabold (800), and black (900). You can also pass these numbers directly. Available weights depend on the font you load.

Light

Normal

Medium

Semibold

Bold

Numeric weight: 900

<Flex direction="column" gap="2">
  <Text weight="light">Light</Text>
  <Text weight="normal">Normal</Text>
  <Text weight="medium">Medium</Text>
  <Text weight="semibold">Semibold</Text>
  <Text weight="bold">Bold</Text>
  <Text weight={900}>Numeric weight: 900</Text>
</Flex>

Spacing and disabled appearance

Text also supports the shared margin and padding props. disabled applies a muted text colour; it is a visual treatment and does not disable interaction.

Currently unavailable

<Text size="sm" mt="2" disabled>
  Currently unavailable
</Text>