Text

6.4.0

O Text é o componente de texto, utilizado para escrever e formatar blocos de conteúdo dentro de páginas ou componentes.

import React from "react";
import { Text } from "@nimbus-ds/components";

const Example: React.FC = () => <Text as="p">Lorem ipsum dolor sit amet</Text>;

export default Example;

O componente Text é composto por um (p) ou (span) estilizado que consome nossos tokens de tipografia para o body, sendo eles o base, o caption e o small.

O conteúdo do componente pode ser alinhado à esquerda, ao centro e à direita. O critério de uso de cada um pode variar caso a caso, sendo o mais comum a esquerda para texto corrido, ao centro para informações únicas ou pontuais e a direita para textos dentro de listas de informações.

O componente permite formatar trechos de conteúdo, sendo possível personalizar o peso e a cor usando a propriedade span.

Utilizamos o Text para escrever texto corrido com hierarquia básica, além de formatar trechos específicos de conteúdo.

Componente Title - Usado para dar título e subtítulo a telas, páginas, blocos de texto, seções ou outros componentes, empregando hierarquia visual e semântica.

Do
Textos em bold devem ser usados para destacar informações pontualmente.

Textos em bold devem ser usados para destacar informações pontualmente.

Don't
O bold deve ser usado com parcimônia, evitando longos blocos de texto.

O bold deve ser usado com parcimônia, evitando longos blocos de texto.

Do
Para textos longos devemos dar preferência a estilos tamanho base.

Para textos longos devemos dar preferência a estilos tamanho base.

Don't
Tamanhos de texto Highlight deve ser evitado para textos longos.

Tamanhos de texto Highlight deve ser evitado para textos longos.

Do
Quando temos conteúdos diferentes em uma mesma linha, devemos manter o mesmo estilo de texto.

Quando temos conteúdos diferentes em uma mesma linha, devemos manter o mesmo estilo de texto.

Don't
Não devemos ter tamanhos contrastantes em uma mesma linha.

Não devemos ter tamanhos contrastantes em uma mesma linha.

Do
Para textos é importante usar cores que não se confundam com outros tipos de elementos.

Para textos é importante usar cores que não se confundam com outros tipos de elementos.

Don't
A cor do conteúdo não deve ser parecida com as cores interativas.

A cor do conteúdo não deve ser parecida com as cores interativas.

Instale o componente via terminal.

npm install @nimbus-ds/text

Additional props are passed to the <Text> element. See p docs for a list of props accepted by the <Text> element.

Text

NameTypeDefaultDescription

children*

React.ReactNode

The content of the link.

as

'p'
'span'

'p'

Type of html tag to create for the Text component.

color

'currentColor'
'danger-interactive'
'danger-surface'
'danger-textHigh'
'danger-textLow'
'neutral-background'
'neutral-interactive'
'neutral-surface'
'neutral-textDisabled'
'neutral-textHigh'
'neutral-textLow'
'primary-interactive'
'primary-surface'
'primary-textHigh'
'primary-textLow'
'success-interactive'
'success-surface'
'success-textHigh'
'success-textLow'
'warning-interactive'
'warning-surface'
'warning-textHigh'
'warning-textLow'

'neutral-textLow'

The color property is used to set the color of the text.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

fontSize

'base'
'caption'
'highlight'

'base'

The fontSize property sets the size of the text.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

fontWeight

'bold'
'medium'
'regular'

'regular'

The fontWeight property sets how thick or thin characters in text should be displayed.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

lineHeight

'base'
'caption'
'highlight'

'base'

The lineHeight property specifies the line height of the text.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

textAlign

'center'
'justify'
'left'
'right'

'left'

The textAlign property specifies the horizontal alignment of text.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

textDecoration

'line-through'
'none'
'underline'

The textDecoration shorthand property sets the appearance of decorative lines on text.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

wordBreak

'break-all'
'break-word'
'keep-all'
'normal'

The amount of lines at which the text will be trimmed, showing an ellipsis when overflowed.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

lineClamp

number

The amount of lines at which the text will be trimmed, showing an ellipsis when overflowed.

This is a responsive property and you can have the options below available for you to use.

'{ "xs": "value", "md": "value", "lg": "value", "xl": "value" }'

Text.Skeleton

NameTypeDefaultDescription

fontSize

'base'
'caption'
'highlight'

height

string

Height of the skeleton. Useful when you don't want to adapt the skeleton to a text element but for instance a card.

width

string

Width of the skeleton. Useful when the skeleton is inside an inline element with no width of its own.

data-testid

string

This is an attribute used to identify a DOM node for testing purposes.