1.0.6 • Published 4 years ago

react-flagkit-svg v1.0.6

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

React Flagkit SVG

npm version npm downloads

Why yet another package?

  • Supports tree shaking
  • Uses svg instead of img tags
  • Adds typings

Installation

yarn add react-flagkit-svg
npm install react-flagkit-svg

Usage

import React from "react";
import { DE } from "react-flagkit-svg";

const App = () => {
  return <DE />;
};

export default App;

Flags can be sized - based on height (default: 15)

<DE size={30} />

You can also distort them by only passing width / height values

// Add perserveAspectRatio='none' to allow distortion
<DE width={21} height={15} preserveAspectRatio="none" />

Also works great with utility classes i.e. frameworks like tailwindcss

<DE className="h-12 w-auto rounded-sm" />

If you can't use ES6 imports, it's possible to include flag from the compiled folder ./dist.

var DE = require("react-flagkit-svg/dist/flags/DE").default;

var MyComponent = React.createClass({
  render: function() {
    return <DE />;
  }
});

You can also include the whole flag pack:

import React from "react";
import * as Flag from "react-flagkit-svg";

const App = () => {
  return <Flag.DE />;
};

export default App;

Readme and build process inspired by react-feather

1.0.6

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago