Tipografía
Text
Texto en línea que solo cambia lo que indicas y hereda todo lo demás.
Propósito
Text da estilo a una frase dentro de otro texto: énfasis, código en línea, una nota atenuada, un
enlace con estilo mediante asChild. Hereda tamaño, fuente, peso y color salvo que los indiques, y
nunca se recorta.
Importación
import { Text } from "@neshel-ui/typography";Uso
Vista previa: text-inline
Run neshel generate after editing the configuration. The command is idempotent, and unchanged output is never rewritten. Read the CLI reference for details.
import { Paragraph, Text } from "@neshel-ui/typography";
/** Text styles inline phrases and inherits everything it does not set. */
export default function TextInline() {
return (
<Paragraph measure="comfortable">
Run{" "}
<Text as="code" family="mono" size="sm">
neshel generate
</Text>{" "}
after editing the configuration. The command is{" "}
<Text as="strong" weight="semibold">
idempotent
</Text>
, and <Text tone="muted">unchanged output is never rewritten</Text>. Read the{" "}
<Text asChild weight="medium" tone="primary">
<a href="#cli">CLI reference</a>
</Text>{" "}
for details.
</Paragraph>
);
}API
TextProps
| Prop | Tipo | Predeterminado | Descripción |
|---|---|---|---|
| align | Responsive<TextAlign> | — | Alineación del texto (lógica: start/end). |
| as | E | — | — |
| asChild(obligatoria) | boolean | — | — |
| family | FontRole | — | Rol de fuente (Heading "display", Paragraph y Caption "body"; Text hereda). |
| leading | Responsive<TextLeading> | — | Interlineado sin unidades; por defecto, el del tamaño. Controla el recorte de Capsize. |
| measure | TextMeasure | — | Longitud máxima de línea: narrow 45ch, comfortable 65ch, wide 80ch. |
| ref | Ref<HTMLElement> | — | — |
| size | Responsive<TextSize> | — | Token de tamaño; font-size = token × la escala de altura de mayúsculas del rol de fuente. |
| tone | TextTone | — | Rol de color emparejado con el fondo por contraste (Caption usa "muted" por defecto). |
| tracking | TextTracking | — | Espaciado entre letras. |
| truncate | boolean | — | Una línea con puntos suspensivos (recorta el desbordamiento, así que se elimina el recorte de Capsize). |
| weight | Responsive<TextWeight> | — | Peso de la fuente; Heading usa "semibold" por defecto. |
| wrap | TextWrap | — | Estrategia de ajuste de línea (balance encaja con encabezados, pretty con párrafos). |
También acepta las props de: React DOM attributes.
TextElement
type TextElement = "span" | "p" | "div" | "strong" | "em" | "b" | "i" | "small" | "code" | "kbd" | "samp" | "mark" | "abbr" | "cite" | "q" | "s" | "del" | "ins" | "sub" | "sup" | "time" | "dfn"Errores habituales
- Usar
Text as="p"para párrafos: usaParagraph(recortado, con espaciado de bloque). - Pasar
trimaText: lanza un error, porque el texto en línea no se puede recortar.