Skip to content

Text

import { Text } from 'yarcl';
Subheading style

Body text is the default text style.

Muted text for secondary information.

primaryneutralsuccesswarningdangerinfo
Caption styleconst code = 'monospace';
<Text textStyle="subheading">Subheading style</Text>
<Text as="p" muted>Muted text for secondary information.</Text>
<Text color="danger">danger</Text>

textStyle accepts the keys of your text styles. It defaults to defaults.textStyle.

One line that is far too long for this narrow box and ends with an ellipsis.Two lines of text that keep going well past the second line, so everything after it is clamped away with an ellipsis at the end.
<Text truncate>One line…</Text>
<Text truncate={2}>Two lines…</Text>
PropTypeDefaultDescription
asTextElement'span'Element to render.
colorColorconfigSemantic color, from the colors config. Inherits the surrounding color when omitted.
mutedbooleanUses the muted neutral color, for secondary text.
textStyleTextStyleconfigconfig.defaults.textStyleText style, from the typography.styles config.
truncatenumber | booleanTruncates with an ellipsis: true for one line, a number for that many lines.