greenflag

254 country flags for React Native and Expo, in rectangular and circular shapes, with an optional waving animation. Browse the full set below; the feature notes after it cover how the component behaves.

$ npm install greenflag-rn
254flags
2shapes
4 KBper flag imported
MITlicence

Index

Every flag

Search by country name, alpha-2, alpha-3 or numeric code. Select any flag for its codes and downloads.

Reference

Feature notes

How the component behaves, one property at a time. Each specimen is real output; the code beside it is what produces it.

Shapes

Two shapes, one footprint

A circle’s diameter is the rectangle’s height, not its width — so both shapes occupy the same vertical space and switching between them never moves a layout. The trade-off: size={32} gives a 24 px circle.

<Flag code="IN" size={56} />
<Flag code="IN" size={56} shape="circle" />

Sizes

Named tokens or any number

S, M and L map to 16, 20 and 32. Anything else takes a number. Because the artwork is vector, every size is drawn at its true resolution rather than scaled.

<Flag code="IN" size="S" />   // 16
<Flag code="IN" size="M" />   // 20
<Flag code="IN" size="L" />   // 32
<Flag code="IN" size={48} />
<Flag code="IN" size={72} />

Style options

Border, radius, shadow

Japan is the clearest test — a plain field makes each option obvious. The hairline border keeps pale flags legible against a white surface, which is why it is on by default. Corner radius applies to rectangles only.

<Flag code="JP" />
<Flag code="JP" hasBorder={false} />
<Flag code="JP" hasDropShadow />
<Flag code="JP" hasBorderRadius={false} />

Codes

Five ways to say India

Alpha-2, alpha-3, numeric, lowercase and a plain number all resolve to the same flag. Numeric codes are zero-padded internally, so 20 and "020" both find Andorra.

<Flag code="IN" />
<Flag code="IND" />
<Flag code="356" />
<Flag code="in" />
<Flag code={356} />

Fallback

Unknown codes never throw

An unexpected value from an API renders fallback instead of crashing the screen. Without one, nothing renders. The dashed box below is the fallback.

<Flag
  code={user.country}
  fallback={<Placeholder />}
/>

Motion

A ripple that travels

The flag is sliced into 14 vertical strips, each displaced on a phase-shifted sine so a crest moves left to right, and sheared to the wave’s local slope so horizontal edges read as curves rather than a staircase. The shear is skewY, not rotate — rotation tilts vertical edges too and reads as twisting. This page runs the same technique in CSS.

<Flag code="IN" wave />
<Flag code="IN" wave wavePeriod={4} />

// 14 draws per waving flag —
// fine for a header, not for
// every row of a long list.