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

Usage

Preview: text-inline
Preview theme

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
PropTypeDefaultDescription
alignResponsive<TextAlign>—Text alignment (logical: start/end).
asE——
asChild(required)boolean——
familyFontRole—Font role (Heading "display", Paragraph and Caption "body"; Text inherits).
leadingResponsive<TextLeading>—Unitless line height; defaults to the size's leading. Drives Capsize trimming.
measureTextMeasure—Maximum line length: narrow 45ch, comfortable 65ch, wide 80ch.
refRef<HTMLElement>——
sizeResponsive<TextSize>—Size token; font-size = token × the font role's cap-height scale.
toneTextTone—Colour role paired with the background for contrast (Caption defaults to "muted").
trackingTextTracking—Letter spacing.
truncateboolean—One line with an ellipsis (clips overflow, so trimming is removed).
weightResponsive<TextWeight>—Font weight; Heading defaults to "semibold".
wrapTextWrap—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: use Paragraph (trimmed, block spacing).
  • Passing trim to Text: it throws — inline text cannot be trimmed.
Edit on GitHub

On this page