Typography
Text
Inline text that changes only what you set and inherits everything else.
Purpose
Text styles a phrase inside other text — emphasis, inline code, a muted note, a styled link via
asChild. It inherits size, font, weight and colour unless you set them, and it is never trimmed.
Import
import { Text } from "@neshel-ui/typography";Usage
Preview: 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 | Type | Default | Description |
|---|---|---|---|
| align | Responsive<TextAlign> | — | Text alignment (logical: start/end). |
| as | E | — | — |
| asChild(required) | boolean | — | — |
| family | FontRole | — | Font role (Heading "display", Paragraph and Caption "body"; Text inherits). |
| leading | Responsive<TextLeading> | — | Unitless line height; defaults to the size's leading. Drives Capsize trimming. |
| measure | TextMeasure | — | Maximum line length: narrow 45ch, comfortable 65ch, wide 80ch. |
| ref | Ref<HTMLElement> | — | — |
| size | Responsive<TextSize> | — | Size token; font-size = token × the font role's cap-height scale. |
| tone | TextTone | — | Colour role paired with the background for contrast (Caption defaults to "muted"). |
| tracking | TextTracking | — | Letter spacing. |
| truncate | boolean | — | One line with an ellipsis (clips overflow, so trimming is removed). |
| weight | Responsive<TextWeight> | — | Font weight; Heading defaults to "semibold". |
| wrap | TextWrap | — | Line wrapping strategy (balance suits headings, pretty paragraphs). |
Also accepts the props of: 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"Common mistakes
- Using
Text as="p"for paragraphs: useParagraph(trimmed, block spacing). - Passing
trimtoText: it throws — inline text cannot be trimmed.