Saltar al contenido
Neshel-UI
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.tsx
import { Text } from "@neshel-ui/typography";

Uso

Vista previa: text-inline
Tema de la vista previa

Run neshel generate after editing the configuration. The command is idempotent, and unchanged output is never rewritten. Read the CLI reference for details.

text-inline.tsx
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

TextProps
PropTipoPredeterminadoDescripción
alignResponsive<TextAlign>—Alineación del texto (lógica: start/end).
asE——
asChild(obligatoria)boolean——
familyFontRole—Rol de fuente (Heading "display", Paragraph y Caption "body"; Text hereda).
leadingResponsive<TextLeading>—Interlineado sin unidades; por defecto, el del tamaño. Controla el recorte de Capsize.
measureTextMeasure—Longitud máxima de línea: narrow 45ch, comfortable 65ch, wide 80ch.
refRef<HTMLElement>——
sizeResponsive<TextSize>—Token de tamaño; font-size = token × la escala de altura de mayúsculas del rol de fuente.
toneTextTone—Rol de color emparejado con el fondo por contraste (Caption usa "muted" por defecto).
trackingTextTracking—Espaciado entre letras.
truncateboolean—Una línea con puntos suspensivos (recorta el desbordamiento, así que se elimina el recorte de Capsize).
weightResponsive<TextWeight>—Peso de la fuente; Heading usa "semibold" por defecto.
wrapTextWrap—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: usa Paragraph (recortado, con espaciado de bloque).
  • Pasar trim a Text: lanza un error, porque el texto en línea no se puede recortar.
Editar en GitHub

En esta página