Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Data display

Typography

Applies the library type scale to headings, body text, quotes and code.

Selector: mui-typography

Import
import { Typography } from '@mushilu-san/ui/data-display';
PreviewCode

Loading example…

Overview

Typography applies the type scale to its content. variant picks the style: h1 to h4 for headings, p, lead, large, small and muted for body text, and code and blockquote.

Heading variants (h1–h4) are exposed as role="heading" with the matching aria-level, so screen readers see the outline.

When to use

  • Headings and body text that should match the type scale without a custom class.
  • Consistent text styles across many pages.

When not to use

  • A one-off piece of text with a unique style. Write it in your own stylesheet.

Guidelines

Do

  • Wrap a heading variant in a native <h1>–<h4> so the page outline stays correct.
  • Use large or lead for emphasis that is not a heading.

Don't

  • Do not rely on variant="h1" alone to mark a page heading.
  • Do not pick a heading variant only for its size.

Accessibility

Roles and attributes

ElementRoleNotes
host— (no role)Heading variants get role="heading" and aria-level. Other variants have no role.
  • Text contrast depends on the surrounding surface. muted text must still meet 4.5:1 against its background.

API

Typography

Selector: mui-typography

NameTypeDefaultDescription
variant'muted' | 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'lead' | 'large' | 'small' | 'code' | 'blockquote''p' Type style: `h1`–`h4`, `p`, `lead`, `large`, `small`, `muted`, `code` or `blockquote`. Default `p`.

CSS parts

  • ::part(root)

Tokens

  • --mui-font-sans
  • --mui-font-size-base
  • --mui-font-weight-medium
  • --mui-color-text
  • --mui-color-text-muted