Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Flag

A country's flag from its ISO code, sized to the text beside it.

Shipping from Portugal to Japan, Poland and the United States.

  • Japan JP
  • Poland PL
  • France FR
  • Germany DE
  • Brazil BR
  • India IN
  • Kenya KE
  • Canada CA
  • Mexico MX
  • New Zealand NZ
  • Unknown region ZZ
Japan Poland Nepal

Installation

pnpm add @heyramzi/ui

Usage

import { Flag } from "@heyramzi/ui/components/flag";

Keyboard and accessibility

  • The flag is hidden from screen readers by default, because the country name sits beside it.
  • Shown alone, pass label="Japan" and it becomes an image with that name.

API reference

code required string | null | undefined
ISO 3166-1 alpha-2 code, or XK for Kosovo, any case. Unknown or empty renders nothing.
label string
Names the flag for a reader. Leave it out when the country name sits beside it.
base string
Default FLAG_BASE
Where the host serves `<CODE>.svg`.
class string
Prop Type Default
code required

ISO 3166-1 alpha-2 code, or XK for Kosovo, any case. Unknown or empty renders nothing.

string | null | undefined
label

Names the flag for a reader. Leave it out when the country name sits beside it.

string
base

Where the host serves `<CODE>.svg`.

string FLAG_BASE
class string