Typography
Typography
Semantic text presets on datui's type scale: DisplayTitle, Title, Headline, Text, Paragraph, Subhead, Footnote, Caption and EllipsisText.
import { Title, DisplayTitle, Headline, Text, Paragraph, Subhead, Footnote, Caption, EllipsisText, Typography } from "datui";Playground
The quick brown fox
<Title level="1" weight="semibold">The quick brown fox</Title>Examples
Type scale
Display title
Title 1
Title 2
Title 3
Headline 1
Headline 2
Text — default body copyParagraph — multi-line copy for longer descriptions and articles.
SubheadFootnoteCaption 1Caption 2Caption 3Weight, element and caps
weight, as and caps adjust any preset.
Regular title
Bold title
Headline rendered as a paragraph
Section labelTruncation
EllipsisText clamps to maxLines and exposes the full text as a native tooltip.
Accessibility
TitleandDisplayTitlerenderh1–h4matchinglevel; override withaswhen the visual size and document outline differ.Paragraphrenders<p>;Text,Subhead,FootnoteandCaptionrender<span>.capsonly changes presentation; screen readers read the original text.
API
Title
Section and page headings. Renders `h1`–`h3` by level.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | 2 | 3 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
DisplayTitle
Hero-sized headings. Renders `h1`–`h4` by level.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | 4 | 2 | 3 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
Headline
Emphasized short text such as card titles.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | 2 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
Text
Default body text.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
Paragraph
Multi-line body copy.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
Subhead
Secondary text under titles. Renders a `span`; pass `as` for a heading.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
Footnote
Small supporting text.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
Caption
Labels, metadata and fine print.
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| level | 1 | 2 | 3 | — | |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |
EllipsisText
Truncates text with an ellipsis after `maxLines` lines and exposes the full text as a tooltip.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | |
| maxLines | number | 1 | Clamp to this many lines. |
| maxWidth | string | number | — | Max width of the text box (CSS length or px number). |
Typography
Base text primitive. Prefer the semantic presets (`Title`, `Text`, `Caption`, ...).
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | span | Element to render. |
| caps | boolean | — | Uppercase with letter spacing. |
| className | string | — | |
| inline | boolean | — | Render as `inline` instead of block. |
| normalize | boolean | true | Remove default margins so the text sits flush in layouts. |
| weight | TypographyWeight | — |