Components
Toggle sidebar

Flag

Display a flag using its two-letter Unicode region code.

Copy to clipboard
import { Flag } from '@fluxui-dev/react';<Flag country="US" />

Sizes

Use the size prop to change the width of the flag. The default aspect ratio is 3:2.

Copy to clipboard
<Flag country="US" size="xl" /><Flag country="US" size="lg" /><Flag country="US" size="md" /><Flag country="US" /><Flag country="US" size="xs" />

Circle

Use the circle prop for a circular crop.

Copy to clipboard
<Flag circle country="US" />

Registry

The built-in registry follows Unicode's Recommended for General Interchange (RGI) two-letter flag sequences. Inclusion provides compatibility with that external standard and does not express a position on the status of any country, territory, government, or border.

Built-in flags load from a CDN. Use the src prop for anything outside the registry, or to serve flags yourself.

Examples

Country select

Pair a flag with a select of country names, showing the flag of the selected country beside it.

Copy to clipboard
import { useState } from 'react';import { Flag, Select } from '@fluxui-dev/react';const [country, setCountry] = useState('US');<div className="flex items-center gap-3">    <Flag country={country} />    <Select value={country} onValueChange={setCountry} aria-label="Country">        {countries.map((country) => (            <Select.Option key={country.code} value={country.code}>{country.name}</Select.Option>        ))}    </Select></div>

Currency select

Use a representative region flag as a visual cue while keeping the currency code as the value.

Copy to clipboard
const [currency, setCurrency] = useState('USD');const selected = currencies.find((item) => item.code === currency);<div className="flex items-center gap-3">    <Flag country={selected?.country} />    <Select value={currency} onValueChange={setCurrency} aria-label="Currency">        {currencies.map((currency) => (            <Select.Option key={currency.code} value={currency.code}>{currency.code} — {currency.name}</Select.Option>        ))}    </Select></div>

Analytics card

Use flags as compact visual anchors in country-based reports.

Copy to clipboard
import { Card, Flag, Heading, Text } from '@fluxui-dev/react';<Card variant="soft">    <div className="flex items-baseline justify-between gap-4">        <Heading>Countries</Heading>        <Text className="font-medium">Visitors</Text>    </div>    <div className="mt-6 space-y-5">        {countries.map((country) => (            <div key={country.code} className="flex items-center gap-3">                <Flag country={country.code} size="md" className="w-7" />                <Text className="min-w-0 flex-1 truncate">{country.name}</Text>                <Text className="font-medium">{country.visitors}</Text>            </div>        ))}    </div></Card>

Custom flags

Use the src prop for a subdivision, organization, historical flag, or any other image outside the built-in registry.

Copy to clipboard
<Flag src="/img/flags/california.svg" alt="California" size="xl" />

Accessibility

Flags are decorative by default and render with an empty alt. Add alternative text only when the flag communicates information that is not already present nearby.

Copy to clipboard
{/* Decorative because the adjacent text already names the country... */}<div className="flex items-center gap-2">    <Flag country="CA" />    <span>Canada</span></div>{/* Informative when no nearby text communicates the country... */}<Flag country="CA" alt="Canada" />

Reference

Flag

Prop
Description
country
Unicode RGI two-letter region code. Case-insensitive.
src
Custom image URL. When present, this takes precedence over country.
alt
Alternative text for the image. Default: an empty string.
size
Width of the flag. Options: xs (20px), sm (24px, default), md (32px), lg (40px), xl (48px).
circle
If true, crops the flag to a circle.
CSS
Description
className
Additional CSS classes applied to the flag, such as a width that overrides size.
Attribute
Description
data-flux-flag
Applied to the root element for styling and identification.
data-country
The uppercase region code, when country is set.

flagUrl()

Prop
Description
country
Returns the URL of a built-in flag, such as flagUrl('CA'), or undefined for a code outside the registry.
Copyright © 2026 Wireable LLC ·Terms of Service
Built with by
Caleb Porzio and Hugo Sainte-Marie