import-google-fonts
Import fonts from Google Fonts with styled-components.
Installation
You can install it with npm or yarn.
Try:
npm install import-google-fonts
yarn add import-google-fonts
Usage
See a simple example:
const GoogleFonts = const MyText = styledh1` font-family: 'Pacifico', cursive;` const App = <Fragment> <GoogleFonts /> <MyText> Hello World! </MyText> </Fragment> ReactDOM
Syntax
When:
inject
- ThecreateGlobalStyle
function in v4 and above orinjectGlobal
in v3 and bellow.protocol
- Can be'http'
or'https'
. The default value is'https'
.fonts
- An array with the fonts you want to import.
NOTE: In styled-components v3 and below you don't need to create a component.
License
MIT © Matheus Alves