Text

Text makes your text fit in your boxes will built-in ellipsis support.

Basic

This is a simple text, nothing fancy.

Headings

Text component has built-in variants for h* elements.

h1. Heading

h2. Heading

h3. Heading

h4. Heading

h5. Heading
h6. Heading

Customize Headings

Variant and semantic are two different things, you could use a variant h1 and choose to use a h2 tag using forwardedAs. In the following example, we use div for each of them.

h1. Heading
h2. Heading
h3. Heading
h4. Heading
h5. Heading
h6. Heading

Display Headings

Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a display heading—a larger, slightly more opinionated heading style. Keep in mind these headings are not responsive by default.

Display 1

Display 2

Display 3

Display 4

Add a new variant

Variants are defined in texts section of your theme, you can add a variant by customizing your theme.

Hello world

Ellispis & multilines

Make your text fit on one line or several lines using lines property.

This text should fit on one line.This text should fit on two lines, and takes the space of two lines.

Accessibility

  • The ellipsis uses line-clamp, it means your text stay in the page and is visible by screen reader.
  • By default, variants induces the HTML element that will be used, but your are free to use yours.

API

Text

PropertyTypeRequiredDefaultDescription
childrennodefalse-
linesnumberfalse-Control the number of lines to display
variants
union
falseprimaryControl the color variant of the component.
Show xstyled properties