Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benaubin/tiny-flag-react
https://github.com/benaubin/tiny-flag-react
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/benaubin/tiny-flag-react
- Owner: benaubin
- Created: 2020-06-29T19:01:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-12T16:19:44.000Z (over 3 years ago)
- Last Synced: 2024-11-17T18:11:27.577Z (about 2 months ago)
- Language: TypeScript
- Size: 16.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tiny Flag React
Display country flags in less than 1KB with the magic of unicode (with graceful fallbacks).
Displays emoji by default, when not supported, falls back to an image tag.
[DEMO](https://codesandbox.io/s/country-flags-wz5g7?fontsize=14&hidenavigation=1&theme=dark)
## Install
```sh
npm i --save tiny-flag-react
yarn add tiny-flag-react
```## Usage
```js
import TinyFlag from "tiny-flag";;
```[DEMO](https://codesandbox.io/s/country-flags-wz5g7?fontsize=14&hidenavigation=1&theme=dark)
## Recommended Fallback Images
Goes well with [FlagKit](https://github.com/madebybowtie/FlagKit.git) and Webpack's
[file-loader](https://webpack.js.org/loaders/file-loader/) for fallback images:```sh
npm i --save https://github.com/madebybowtie/FlagKit.git
yarn add https://github.com/madebybowtie/FlagKit.git
``````js
let country = "US";
let countryName = "United States";```