@atomixdesign/rem-scaling
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

Usage

Attach the rem font scaling

import { HtmlFontSetter } from '@atomixdesign/rem-scaling'


new HtmlFontSetter({
  min: 12, // Min px size
  max: 16, // Max px size
  base: 16, // Default px size (normally this is the max size). Used for when no breakpoints match
  breakpoints: {
    md: [768, 1024], // Font-size @768: 12px, @1024: 16px
    lg: [1024, 1600],
  },
  fallback: [Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY], // Fallback breakpoint for SSR, if no SSR is needed just use this
})

If you'd like to remove the rem scaling in the future, simply call the return value

import { HtmlFontSetter } from '@atomixdesign/rem-scaling'

const instance = new HtmlFontSetter({ ... })

instance.destroy()

/@atomixdesign/rem-scaling/

    Package Sidebar

    Install

    npm i @atomixdesign/rem-scaling

    Weekly Downloads

    76

    Version

    2.1.1

    License

    MIT

    Unpacked Size

    48.4 kB

    Total Files

    55

    Last publish

    Collaborators

    • jakeatomix
    • jackatomix