8.0.0 • Published 8 years ago

@dr-kobros/react-webfont-loader v8.0.0

Weekly downloads
2,443
License
BSD-3-Clause
Repository
gitlab
Last release
8 years ago

Webfonts loader for React

What?

A React wrapper for Typekit's webfontloader NPM package.

Why?

To load your webfonts more intelligently, avoid FOUT with them, and / or to ensure that they have REALLY loaded before doing something (use them in canvas etc).

How?

import { render } from 'react-dom';
import WebfontLoader from '@dr-kobros/react-webfont-loader';

// webfontloader configuration object. *REQUIRED*.
const config = {
  google: {
    families: ['Source Sans Pro:300,600'],
  }
};

// Callback receives the status of the general webfont loading process. *OPTIONAL*
const callback = status => {
  // I could hook the webfont status to for example Redux here.
};

// wrap your root component with the supplied wrapper component.
render(
  <WebfontLoader config={config} onStatus={callback}>
    <App />
  </WebfontLoader>,
  document.getElementById('app')
);
8.0.0

8 years ago

7.0.2

8 years ago

7.0.1

8 years ago

7.0.0

8 years ago

6.0.0

8 years ago

5.0.0

8 years ago

4.0.0

8 years ago

3.0.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.0

9 years ago

0.1.0

9 years ago