Typography
Typography standardizes text, title, paragraph, link, copy, edit, and ellipsis behavior.
@duskmoon-dev/components/typography Usage
When to use
- Use it to clarify state, metadata, content hierarchy, or loading without creating a new workflow.
- Pair it with semantic content so visual treatment never becomes the only source of meaning.
Implementation notes
Features
Focuses on status, metadata, empty/loading states, or content grouping without owning application state.
Uses DuskMoon tokens so the component follows the active docs theme.
Typography is most often configured through `editing`, `icon`, `tooltip`, `triggerType`.
Renders root and semantic text states
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and Typography from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function Example() {
return (<Typography>DuskMoon Typography</Typography>);
} Renders root and semantic text states
test-backedTypography scenario from the component test coverage: renders root and semantic text states.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function TypographyRendersRootAndSemanticDemo() {
return (<Typography>DuskMoon Typography</Typography>);
} Renders title level, paragraph, and link
test-backedTypography scenario from the component test coverage: renders title level, paragraph, and link.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function TypographyRendersTitleLevelParagraphDemo() {
return (<Typography>DuskMoon Typography</Typography>);
} Supports copyable text
test-backedTypography scenario from the component test coverage: supports copyable text.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function TypographySupportsCopyableTextDemo() {
return (<Typography>DuskMoon Typography</Typography>);
} Supports editable text save and cancel
test-backedTypography scenario from the component test coverage: supports editable text save and cancel.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function TypographySupportsEditableTextSaveDemo() {
return (<Typography>DuskMoon Typography</Typography>);
} Supports expandable ellipsis
test-backedTypography scenario from the component test coverage: supports expandable ellipsis.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function TypographySupportsExpandableEllipsisDemo() {
return (<Typography>DuskMoon Typography</Typography>);
} Prevents disabled link navigation
test-backedTypography scenario from the component test coverage: prevents disabled link navigation.
import "@duskmoon-dev/components/styles.css";
import { Typography } from "@duskmoon-dev/components/typography";
export function TypographyPreventsDisabledLinkNavigationDemo() {
return (<Typography>DuskMoon Typography</Typography>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Typography>DuskMoon Typography</Typography>
</div>
<div data-theme="moonlight">
<Typography>DuskMoon Typography</Typography>
</div> API
The API reference below lists every parsed exported type or interface for Typography. Start with `editing`, `icon`, `tooltip`, `triggerType` for common usage.
packages/components/src/components/typography/Typography.types.ts
Scenarios: packages/components/src/components/typography/Typography.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
editing | boolean | No | editing configures Typography. |
icon | ReactNode | No | icon configures Typography. |
tooltip | ReactNode | No | tooltip configures Typography. |
triggerType | "icon" | "text" | Array<"icon" | "text"> | No | triggerType configures Typography. |
enterIcon | ReactNode | No | enterIcon configures Typography. |
text | string | No | text configures Typography. |
maxLength | number | No | maxLength configures Typography. |
autoSize | boolean | { minRows?: number; maxRows?: number } | No | autoSize configures Typography. |
onStart | () => void | No | onStart configures Typography. |
onChange | (value: string) => void | No | onChange configures Typography. |
onCancel | () => void | No | onCancel configures Typography. |
onEnd | () => void | No | onEnd configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
text | string | No | text configures Typography. |
icon | ReactNode | [ReactNode, ReactNode] | No | icon configures Typography. |
tooltips | false | ReactNode | [ReactNode, ReactNode] | No | tooltips configures Typography. |
format | TypographyCopyFormat | No | format configures Typography. |
onCopy | (event?: ClipboardEvent | React.MouseEvent<HTMLElement>) => void | No | onCopy configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
rows | number | No | rows configures Typography. |
expandable | boolean | "collapsible" | No | expandable configures Typography. |
suffix | string | No | suffix configures Typography. |
symbol | ReactNode | ((expanded: boolean) => ReactNode) | No | symbol configures Typography. |
tooltip | ReactNode | No | tooltip configures Typography. |
onExpand | ( | No | onExpand configures Typography. |
event | React.MouseEvent<HTMLElement>, | Yes | event configures Typography. |
info | { expanded: boolean }, | Yes | info configures Typography. |
onEllipsis | (ellipsis: boolean) => void | No | onEllipsis configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
type | TypographyStatus | No | type configures Typography. |
disabled | boolean | No | disabled configures Typography. |
mark | boolean | No | mark configures Typography. |
code | boolean | No | code configures Typography. |
keyboard | boolean | No | keyboard configures Typography. |
underline | boolean | No | underline configures Typography. |
delete | boolean | No | delete configures Typography. |
strong | boolean | No | strong configures Typography. |
italic | boolean | No | italic configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
editable | TypographyEditable | No | editable configures Typography. |
copyable | TypographyCopyable | No | copyable configures Typography. |
ellipsis | TypographyEllipsis | No | ellipsis configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
size | TypographySize | No | size configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
level | TypographyLevel | No | level configures Typography. |
| Prop | Type | Required | Description |
|---|---|---|---|
ellipsis | TypographyEllipsis | No | ellipsis configures Typography. |
"secondary" | "success" | "warning" | "danger" "sm" | "md" | "lg" 1 | 2 | 3 | 4 | 5 "text/plain" | "text/html" boolean | TypographyEditableConfig boolean | TypographyCopyableConfig boolean | TypographyEllipsisConfig ComponentProps<"div"> ForwardRefExoticComponent< TextProps & RefAttributes<HTMLSpanElement> > ForwardRefExoticComponent< ParagraphProps & RefAttributes<HTMLParagraphElement> > ForwardRefExoticComponent< TitleProps & RefAttributes<HTMLHeadingElement> > ForwardRefExoticComponent< LinkProps & RefAttributes<HTMLAnchorElement> > ForwardRefExoticComponent< TypographyProps & RefAttributes<HTMLDivElement> > & { Text: TextComponent