flag-icons-kit
v0.1.3
Published
Lightweight flag icons by country code (sample package)
Downloads
13
Maintainers
Readme
flag-icons-kit (sample)
Lightweight flag icons by ISO 3166-1 alpha-2 code. This repository is a starter template for an npm package that exposes a Flag React component and includes sample flag SVGs. It ships with both 4x3 and 1x1 sample flags. Add the full set (e.g. from lipis/flag-icons) before publishing.
Usage (after npm install):
import { Flag, getFlagUrl } from 'flag-icons-kit'
// Simple (lazy loads each flag on demand)
<Flag code="IN" ratio="4x3" width={48} />
// If you prefer to fetch the URL yourself:
getFlagUrl('US', '1x1').then(url => {
// use the url as <img src={url} />
})How to add full flag set:
- Clone or download https://github.com/lipis/flag-icons
- Copy
flags/4x3andflags/1x1intosrc/flags/4x3andsrc/flags/1x1respectively.
Publishing notes:
- Keep
reactandreact-domas peerDependencies. - Only include the
distfolder infileswhen publishing.
