Typography

Semantic heading, text, and inline code primitives keep content hierarchy token-driven.

Overview and decision boundary

Use Typography primitives to preserve semantic document structure and token-driven hierarchy.

Do not use Heading to style non-heading content or hard-code type values in product UI.

Preview

Workspace settings

Changes apply to every member.

Install with nerio add typography.

import { Code, Heading, Text } from '@nerio-ui/ui';<Heading as="h2" size="lg">Workspace settings</Heading><Text tone="secondary">Changes apply to every member.</Text><Code>nerio add typography</Code>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add typographyimport { Code, Heading, Text } from '@nerio-ui/ui';

Usage

import { Code, Heading, Text } from '@nerio-ui/ui';<Heading as="h2" size="lg">Workspace settings</Heading><Text tone="secondary">Changes apply to every member.</Text><Code>nerio add typography</Code>

Variants

VariantPurpose
heading sizesHeading sizes is part of the public component contract.
text tonesText tones is part of the public component contract.

Anatomy

SlotPurpose
headingSemantic heading level with an independent visual size.
textSupporting copy with default, secondary, or tertiary tone.
codeShort inline code token for commands, names, and values.

States

StatePurpose
DefaultTypography adapts through semantic text and font tokens.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Use Heading as the correct semantic level for the document outline, not merely for visual size.
  • Use Text for supporting copy without replacing native labels or accessible names.
  • Use Code only for short inline code; use pre and code for larger code blocks.
  • Typography presets are scoped CSS token recipes; load Geist or Inter in the consuming product before applying their preset class.

API

PropPurpose
Heading as / sizeControls semantic heading level and visual size independently.
Text toneControls the semantic color role for supporting copy.
CodeRenders a short inline code element.

Implementation contract

ContractValue
Registry itemtypography installs 5 source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use Typography primitives to preserve semantic document structure and token-driven hierarchy.

Do / do not

Do

Use semantic HTML through the as prop and tokenized text roles.

Do not

Do not use Heading to style non-heading content or hard-code type values in product UI.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-color-text-primaryPublic customization point for this component contract.
--n-color-text-secondaryPublic customization point for this component contract.
--n-color-text-tertiaryPublic customization point for this component contract.
--n-font-sansPublic customization point for this component contract.
--n-font-monoPublic customization point for this component contract.
--n-font-sans-systemPublic customization point for this component contract.
--n-font-sans-geistPublic customization point for this component contract.
--n-font-sans-interPublic customization point for this component contract.
--n-font-sans-ibm-plexPublic customization point for this component contract.
--n-font-sans-manropePublic customization point for this component contract.
--n-font-sans-source-sansPublic customization point for this component contract.
--n-font-sans-space-groteskPublic customization point for this component contract.
--n-font-mono-systemPublic customization point for this component contract.
--n-font-mono-geistPublic customization point for this component contract.
--n-font-mono-ibm-plexPublic customization point for this component contract.
--n-line-height-tightPublic customization point for this component contract.