SakaniUI

Flag

A country flag from the Figma flag set: pick it by country code.

Sizes

A 16 x 16 box with the flag drawn in a rounded rectangle across its middle. 16px sits beside text, 32px beside a heading.

Beside text

LondonSingaporeTokyoMumbaiSydney

Accessibility

A flag is decorative by default (aria-hidden): put the country's name in text beside it. If the flag is the only thing that says the country, pass a label and it becomes an image with that name.

Which flags

The Figma set has 254 flags. The ones the library uses are imported (GB, SG, JP, IN, AU); any other code draws a neutral placeholder of the same shape, so a row of flags never shifts. Each further flag is added by dropping its exported SVG markup into src/components/Flag/flags.ts.

a country not imported yet

Props

PropTypeDefaultDescription
countrystringISO 3166-1 alpha-2 code, such as "GB", "JP" or "IN". Case does not matter. Required.
sizenumber16The box size in px. Figma uses 16 beside text and 32 beside a heading. The flag fills the middle of the box.
labelstringThe country's name, when the flag is the only thing that says it. Without it the flag is hidden from assistive tech.
classNamestringExtra class on the svg.