The <CountryFlag /> component uses the Terrabandiere flags by Roberto Mocci.
pnpm dlx shadcn@latest add pxl-ui/registry/country-flag
Copy and paste the following code into your project.
Update the import paths to match your project setup.
import { CountryFlag } from "@/components/ui/pxl/country-flag"<CountryFlag code="ALPHA3 | ALPHA2 | NUMBER" />Use the size prop to change the size of the flag.
<CountryFlag code="ESP" size="sm" />API Reference
Section titled “API Reference”CountryFlag
Section titled “CountryFlag”The CountryFlag component displays a country flag
| Prop | Type | Default |
|---|---|---|
code |
string | number |
- |
size |
"sm" | "md" | "default" |
"default" |
className |
string |
- |