Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmwc/typography

Package Overview
Dependencies
Maintainers
0
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/typography

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

  • 14.3.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
decreased by-33.37%
Maintainers
0
Weekly downloads
 
Created
Source

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/

Basic Usage

<>
  <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>
</>
<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.

<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.

<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

NameTypeDescription
useTypographyTThe typography style.

Keywords

FAQs

Package last updated on 24 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc