Paragraph
Texto principal con longitud de línea, interlineado y ajuste legibles, recortado con Capsize.
Propósito
Paragraph renderiza texto principal (p, o div cuando el contenido incluye elementos de bloque)
con la fuente body en tamaño base.
Importación
import { Paragraph } from "@neshel-ui/typography";Uso
narrow (45ch) — Beautiful typography begins with precision: a readable line length, generous leading and a type scale that keeps its rhythm across breakpoints.
comfortable (65ch), relaxed leading, pretty wrapping — Beautiful typography begins with precision: a readable line length, generous leading and a type scale that keeps its rhythm across breakpoints.
truncate — Beautiful typography begins with precision: a readable line length, generous leading and a type scale that keeps its rhythm across breakpoints.
import { Stack } from "@neshel-ui/layout";
import { Paragraph } from "@neshel-ui/typography";
const text =
"Beautiful typography begins with precision: a readable line length, generous leading and a type scale that keeps its rhythm across breakpoints.";
export default function ParagraphMeasure() {
return (
<Stack space="5">
<Paragraph measure="narrow">narrow (45ch) — {text}</Paragraph>
<Paragraph measure="comfortable" leading="relaxed" wrap="pretty">
comfortable (65ch), relaxed leading, pretty wrapping — {text}
</Paragraph>
<Paragraph truncate className="max-w-sm" tone="muted">
truncate — {text}
</Paragraph>
</Stack>
);
}API
ParagraphProps
| 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. |
| trim | boolean | true | Recorte de Capsize del espacio por encima de la altura de mayúsculas y por debajo de la línea base (true por defecto). |
| 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.
ParagraphElement
type ParagraphElement = "p" | "div"Accesibilidad
Usa measure (comfortable ≈ 65 caracteres) en textos largos: las líneas largas cuestan más de leer.
Evita truncate en información esencial: el texto truncado solo está completo para quien puede verlo
por otros medios.
Errores habituales
- Poner un
divo una lista dentro de<Paragraph>(unp): usaas="div". - Fijar
line-heightcon una clase de utilidad: usaleadingpara que el recorte siga siendo exacto.