# @rmwc/typography

> Material Design’s text sizes and styles were developed to balance content density and reading comfort under typical usage conditions.

Latest version **14.3.5** (published 2024-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rmwc/typography
pnpm add @rmwc/typography
yarn add @rmwc/typography
bun add @rmwc/typography
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 14.3.5 |
| Published | 2024-10-24 |
| First published | 2018-09-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1657 |
| Author | rmwc |
| Maintainers | jamesmfriedman |
| Keywords | rmwc |

## Links

- npm: https://www.npmjs.com/package/@rmwc/typography
- Repository: https://github.com/rmwc/rmwc
- Homepage: https://github.com/rmwc/rmwc/tree/master/packages/typography
- Issues: https://github.com/rmwc/rmwc/issues
- npm.io page: https://npm.io/package/@rmwc/typography

## Dependencies (4)

- [@rmwc/base](https://npm.io/package/@rmwc/base.md) 14.3.5
- [@rmwc/types](https://npm.io/package/@rmwc/types.md) 14.3.5
- [@rmwc/provider](https://npm.io/package/@rmwc/provider.md) 14.3.5
- [@material/typography](https://npm.io/package/@material/typography.md) ^14.0.0

## Recent versions

- 14.3.5 (latest) — 2024-10-24
- 14.0.2-alpha.7 (next) — 2023-10-30
- 14.3.4 — 2024-09-25
- 14.3.3 — 2024-08-30
- 14.3.2 — 2024-08-19
- 14.3.1 — 2024-07-19
- 14.3.0 — 2024-07-18
- 14.2.9 — 2024-07-03
- 14.2.8 — 2024-07-01
- 14.2.7 — 2024-06-30
- 14.2.6 — 2024-06-28
- 14.2.5 — 2024-06-26
- 14.2.2 — 2024-04-24
- 14.2.1 — 2024-04-17
- 14.2.0 — 2024-04-17
- … 158 more at https://npm.io/package/@rmwc/typography/versions

## README

# Typography

Material Design’s text sizes and styles were developed to balance content density and reading comfort under typical usage conditions.

- Module **@rmwc/typography**
- Import styles:
  - Using CSS Loader
    - import '@rmwc/typography/styles';
  - Or include stylesheets
    - **'@material/typography/dist/mdc.typography.css'**
- MDC Docs: [https://material.io/develop/web/components/typography/](https://material.io/develop/web/components/typography/)

## Basic Usage

```jsx
<>
  <Typography use="headline1">headline1</Typography>
  <Typography use="headline2">headline2</Typography>
  <Typography use="headline3">headline3</Typography>
  <Typography use="headline4">headline4</Typography>
  <Typography use="headline5">headline5</Typography>
  <Typography use="headline6">headline6</Typography>
  <Typography use="subtitle1">subtitle1</Typography>
  <Typography use="subtitle2">subtitle2</Typography>
  <Typography use="body1">body1</Typography>
  <Typography use="body2">body2</Typography>
  <Typography use="caption">caption</Typography>
  <Typography use="button">button</Typography>
  <Typography use="overline">overline</Typography>
</>
```

```jsx
<Typography use="headline6" tag="h3">
  headline6
</Typography>
```

## Provider Setup

You can globally map specify type classes to HTML tags for semantics, or specify a default to be used instead of `span`.

```jsx
<RMWCProvider
  typography={{
    /** Make all Typography components default to <div>  */
    defaultTag: 'div',
    /** Make headline5 <h5>  */
    headline5: 'h5',
    /** Make body2 <p>  */
    body2: 'p',
    /** Use your own component  */
    body1: ({ children, ...rest }) => (
      <span>
        <b>{children}!!!</b>
      </span>
    )
  }}
>
  <Typography use="headline6">Rendered default `div`</Typography>
  <Typography use="headline5">Rendered with `h5`</Typography>
  <Typography use="body2">Rendered with `p`</Typography>
  <Typography use="body1">Custom rendering</Typography>
</RMWCProvider>
```

For backwards compatible typography tags, you can import and use `typographyDefaults` from `@rmwc/provider`.

```jsx
<RMWCProvider typography={typographyDefaults}>
  <Typography use="headline6">Rendered default `span`</Typography>
  <Typography use="headline5">Rendered with `span`</Typography>
  <Typography use="body2">Rendered with `span`</Typography>
</RMWCProvider>
```

## Typography
The Typography Component

### Props

| Name | Type | Description |
|------|------|-------------|
| `use` | `TypographyT` | The typography style. |

---
_Source: https://npm.io/package/@rmwc/typography · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
