
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
currency-code-to-country-flag
Advanced tools
React component to display country flags based on currency codes or country codes
A React component library for displaying country flags based on currency codes or country codes. The package includes local SVG flag files in both square (1:1) and rectangular (4:3) aspect ratios.
npm install currency-code-to-country-flag
# or
yarn add currency-code-to-country-flag
You can use the CountryFlag
component in two ways:
import { CountryFlag } from "currency-code-to-country-flag";
function App() {
return (
<div>
<CountryFlag currency="USD" />
<CountryFlag currency="EUR" />
<CountryFlag currency="JPY" />
<CountryFlag currency="LAK" />
<CountryFlag currency="THB" />
<CountryFlag currency="CNY" />
</div>
);
}
import { CountryFlag } from "currency-code-to-country-flag";
function App() {
return (
<div>
<CountryFlag country="US" />
<CountryFlag country="MM" />
<CountryFlag country="DE" />
</div>
);
}
import { CountryFlag } from "currency-code-to-country-flag";
function App() {
return (
<div>
<CountryFlag country="US" ratio="square" /> {/* Square flag (1:1) */}
<CountryFlag country="US" ratio="rectangle" /> {/* Rectangular flag (4:3) */}
</div>
);
}
Prop | Type | Description | Default |
---|---|---|---|
currency | string | ISO 4217 currency code (e.g., 'USD', 'EUR', 'JPY') | - |
country | string | ISO 3166-1 alpha-2 country code (e.g., 'US', 'DE') | - |
size | '16' | '24' | '32' | '48' | '64' | Size of the flag image in pixels | '32' |
ratio | 'square' | 'rectangle' | Aspect ratio of the flag (square 1:1 or rectangular 4:3) | 'square' |
alt | string | Custom alt text for the flag image | Auto-generated |
className | string | Additional CSS class names | '' |
style | React.CSSProperties | Additional inline styles | {} |
currency
or country
prop must be provided.country
takes precedence.Flag icons provided by flag-icons project.
MIT
FAQs
React component to display country flags based on currency codes or country codes
The npm package currency-code-to-country-flag receives a total of 46 weekly downloads. As such, currency-code-to-country-flag popularity was classified as not popular.
We found that currency-code-to-country-flag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.