You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-currency-flags

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-currency-flags

React styled-component for currency flags

0.1.2
latest
Source
npmnpm
Version published
Weekly downloads
5.4K
15.83%
Maintainers
1
Weekly downloads
 
Created
Source

React currency flags

What is this?

Using the images from transferwise/currency-flags, this library uses styled-components to create React components for use in your app. Please be aware that the images are in base64 format, so if you are concerned with the bundle size, I suggest that you clone the aforementioned TransferWise's repo and store it in a CDN solution of your own (the distributed format that repo is also base64 when built, so simply installing that module won't work).

Installation

Yarn

$ yarn add react-currency-flags

NPM

$ npm install react-currency-flags

Usage

import CurrencyFlag from 'react-currency-flags';

const CurrencyFlagComponent1 = () => <CurrencyFlag currency="USD" size="sm" />;

const CurrencyFlagComponent2 = () => <CurrencyFlag currency="EUR" width={38} />;
  • currency (required, string): 3-letter ISO 4217 currency code (https://en.wikipedia.org/wiki/ISO_4217)
  • size (optional, string): The predefined size to use; possible values are sm, md, lg, xl
  • width (optional, number): The width of the flag, height will be calculated to keep aspect ratio if no height value is provided
  • height (optional, number): The height of the flag, width will be calculated to keep aspect ratio if no width value is provided

You should provide either the size, or width or height; size will take precedence if all values are provided.

See examples in the examples folder.

Why not SVG?

While SVG provides the advantage of scaling, but some flags, such as Mexico's, are very complicated graphically, and would therefore create incredibly large file sizes.

Keywords

react

FAQs

Package last updated on 14 May 2020

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