Skip to content

Extras

Flag

Bit.BlazorUI.Extras

BitFlag renders the flag of a country, named by a BitCountry, an ISO 3166-1 code, a dialing code or an English name. It draws the packaged image, a flat or shiny image set of Bit.BlazorUI.Assets, the Unicode emoji or an image of the page's own, in a frame that carries the size and the shape. It is decorative to assistive technologies until named, and OnClick makes it a keyboard-operable button.

Notes

To use this component, you need to install the Bit.BlazorUI.Extras(opens in a new tab) nuget package, as described in the Optional steps of the Getting started page. The image sets of ImageSet ship in the Bit.BlazorUI.Assets(opens in a new tab) nuget package, which that parameter needs as well.

A flag stands for a country, never for a language: a language switcher wants each language's name written in that language.

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basic

Country takes a field of BitCountries, with nothing to look up. The flag is a 16px image of the Extras package; Height takes any CSS length and sets the width with it.

Naming the country

Iso2, Iso3, Code (dialing) and Name take the country as the page's data has it; the first that resolves wins. All are case insensitive, a dialing code is read like a phone number, and Name also answers to everyday names and other spellings. A shared dialing code resolves to the country owning it, so prefer an ISO code where that matters.

Iso2="nl"
Iso3="NLD"
Code="+31"
Name="Netherlands"
Name="Holland" - an everyday name
Name="Czechia" - the current name
Name="Curaçao" - accents ignored
Iso2="UK" - reserved by ISO for the United Kingdom ("GB")
Code="+1" - shared with Canada, owned by the United States

Shape & grayscale

Rounded, Circular, Bordered and Shadow shape the frame, cut to the flag rather than to the square image around it. Bordered keeps a mostly white flag visible on a white surface and takes no extra room. Grayscale marks a country that is not in play.

Rounded
Circular
Bordered
Shadow
Circular Bordered Shadow
Grayscale

Emoji

Emoji draws the Unicode emoji flag: text, so no request and crisp at any size, and it also covers the subdivisions "GB-ENG", "GB-SCT" and "GB-WLS". Its look is the platform's - Windows draws the two letters of the code instead. Unshaped, the frame grows to fit the glyph; shaped, it crops it.

Accessibility

A flag is decorative until named - it usually sits beside the country's name already. Alt names it; AutoAlt uses the country's name. Title and AutoTitle set the tooltip, which is not an accessible name. A named emoji is announced as a picture rather than as two letters, and an unnamed one is hidden from screen readers.

Decorative (the default)
Canada
AutoAlt - named "Canada"
Ships to Canada
Alt - named by the page
Canada
AutoTitle - hover for the tooltip
A named emoji flag

Image sets

ImageSet draws from the Flat or Shiny set of Bit.BlazorUI.Assets (16-64px); the browser fetches only the size the flag and the screen density need, read off a px or rem Height/Width. ImageSize pins one size. A CascadingValue of a BitFlagImageSet sets it for every flag inside. A missing image falls back to the packaged flag.

It needs the Bit.BlazorUI.Assets package. Add its nuget package to the project next to Bit.BlazorUI.Extras; there is nothing to link or register, since the images are static web assets served from _content/Bit.BlazorUI.Assets/flags/. Extras does not reference Assets - the two meet only at that URL - so a missing package is no build error: every flag asking for an image set makes one failed request, then draws the packaged 16px image. That is why ImageSet is opt-in rather than the default.

Why the images are split across two packages. Extras carries one 16px flat image per country - 239 images, about 45KB - which is all a flag at the theme's icon sizes needs on a screen of ordinary density, and is always there for an image set to fall back to. The sets are two artworks at five sizes each - ten images per country, 2,390 images, about 1.1MB - which only a flag drawn large or on a dense screen needs. Kept in Extras, they would land in the published output of every app using any Extras component, most of which never draw a flag past 16px, and an app that precaches its published files for offline use (a PWA's service worker) would download all of them on install. Bit.BlazorUI.Assets is the package of optional static files that only the apps asking for them should carry, its fonts among them, so the sets live there, and only the apps that install it pay for them. Even then a page downloads no more than it draws: the browser is offered every size of a flag and fetches the one its size and the screen's density call for.

The packaged 16px image
ImageSet="BitFlagImageSet.Flat"
ImageSet="BitFlagImageSet.Shiny"
ImageSize="BitFlagImageSize.Size16" - scaled up
Shaped, cut to the flag of the set

Src, SrcPattern & FallbackTemplate

Src points one flag at an image of the page's own; SrcPattern points every flag at a set - a CDN or a vector package - writing in {iso2}/{iso3} (lower case) or {ISO2}/{ISO3} (upper case). A BitCountry of the page's own covers what the table lacks, such as the European Union. A failed image falls back to the packaged flag, then to FallbackTemplate, which also stands in for an unknown country.

Src - an inline vector image
SrcPattern - one url for every country
European Union
A country of the page's own
A failed Src - the packaged flag stands in
An unknown country draws nothing...
...unless a FallbackTemplate stands in
A failed Src with no country to fall back to

Aspect ratio & fit

The frame is square. AspectRatio reshapes it, keeping the height - 4:3 and 3:2 are what vector sets ship. Fit places the image: it covers and crops by default, Contain shows all of it. A packaged or ImageSet flag fills any ratio with the flag itself.

A 3:2 image, cropped to the square frame
AspectRatio="3/2"
AspectRatio="4/3"
Fit="BitImageFit.Contain"
Packaged and ImageSet flags, cropped to the ratio

Loading & events

Images load lazily; Loading=Eager fetches at once. OnLoad and OnError are the image's own events (never fired for an emoji). ImageAttributes land on the img, e.g. a referrerpolicy for a CDN. Press the button to render the flags and count the events.



OnClick & Disabled

OnClick makes the flag a button: focusable, activated by Enter and Space, named by its Alt or else its country, with a pointer target grown to WCAG's 24px without growing the flag. aria-pressed passes through, so screen readers hear the selection too. Disabled dims it and refuses clicks and keys, but keeps its tooltip - hover the last one.


Selected: (none)

All countries

Every country of BitCountries.All, loaded lazily as it scrolls into view, with its name and code beside it.

Afghanistan (AF)
Åland Islands (AX)
Albania (AL)
Algeria (DZ)
American Samoa (AS)
Andorra (AD)
Angola (AO)
Anguilla (AI)
Antarctica (AQ)
Antigua and Barbuda (AG)
Argentina (AR)
Armenia (AM)
Aruba (AW)
Australia (AU)
Austria (AT)
Azerbaijan (AZ)
Bahamas (BS)
Bahrain (BH)
Bangladesh (BD)
Barbados (BB)
Belarus (BY)
Belgium (BE)
Belize (BZ)
Benin (BJ)
Bermuda (BM)
Bhutan (BT)
Bolivia (BO)
Bosnia and Herzegovina (BA)
Botswana (BW)
Brazil (BR)
British Virgin Islands (VG)
Brunei (BN)
Bulgaria (BG)
Burkina Faso (BF)
Burundi (BI)
Cambodia (KH)
Cameroon (CM)
Canada (CA)
Cape Verde (CV)
Cayman Islands (KY)
Central African Republic (CF)
Chad (TD)
Chile (CL)
China (CN)
Christmas Island (CX)
Cocos Islands (CC)
Colombia (CO)
Comoros (KM)
Cook Islands (CK)
Costa Rica (CR)
Croatia (HR)
Cuba (CU)
Curacao (CW)
Cyprus (CY)
Czech Republic (CZ)
Democratic Republic of the Congo (CD)
Denmark (DK)
Djibouti (DJ)
Dominica (DM)
Dominican Republic (DO)
East Timor (TL)
Ecuador (EC)
Egypt (EG)
El Salvador (SV)
Equatorial Guinea (GQ)
Eritrea (ER)
Estonia (EE)
Ethiopia (ET)
Falkland Islands (FK)
Faroe Islands (FO)
Fiji (FJ)
Finland (FI)
France (FR)
French Polynesia (PF)
French Southern Territories (TF)
Gabon (GA)
Gambia (GM)
Georgia (GE)
Germany (DE)
Ghana (GH)
Gibraltar (GI)
Greece (GR)
Greenland (GL)
Grenada (GD)
Guam (GU)
Guatemala (GT)
Guernsey (GG)
Guinea (GN)
Guinea Bissau (GW)
Guyana (GY)
Haiti (HT)
Honduras (HN)
Hong Kong (HK)
Hungary (HU)
Iceland (IS)
India (IN)
Indonesia (ID)
Iran (IR)
Iraq (IQ)
Ireland (IE)
Isle of Man (IM)
Israel (IL)
Italy (IT)
Ivory Coast (CI)
Jamaica (JM)
Japan (JP)
Jersey (JE)
Jordan (JO)
Kazakhstan (KZ)
Kenya (KE)
Kiribati (KI)
Kuwait (KW)
Kyrgyzstan (KG)
Laos (LA)
Latvia (LV)
Lebanon (LB)
Lesotho (LS)
Liberia (LR)
Libya (LY)
Liechtenstein (LI)
Lithuania (LT)
Luxembourg (LU)
Macau (MO)
Macedonia (MK)
Madagascar (MG)
Malawi (MW)
Malaysia (MY)
Maldives (MV)
Mali (ML)
Malta (MT)
Marshall Islands (MH)
Martinique (MQ)
Mauritania (MR)
Mauritius (MU)
Mayotte (YT)
Mexico (MX)
Micronesia (FM)
Moldova (MD)
Monaco (MC)
Mongolia (MN)
Montenegro (ME)
Montserrat (MS)
Morocco (MA)
Mozambique (MZ)
Myanmar (MM)
Namibia (NA)
Nauru (NR)
Nepal (NP)
Netherlands (NL)
Netherlands Antilles (AN)
New Caledonia (NC)
New Zealand (NZ)
Nicaragua (NI)
Niger (NE)
Nigeria (NG)
Niue (NU)
Norfolk Island (NF)
North Korea (KP)
Northern Mariana Islands (MP)
Norway (NO)
Oman (OM)
Pakistan (PK)
Palau (PW)
Palestine (PS)
Panama (PA)
Papua New Guinea (PG)
Paraguay (PY)
Peru (PE)
Philippines (PH)
Pitcairn (PN)
Poland (PL)
Portugal (PT)
Puerto Rico (PR)
Qatar (QA)
Republic of the Congo (CG)
Reunion (RE)
Romania (RO)
Russia (RU)
Rwanda (RW)
Saint Helena (SH)
Saint Kitts and Nevis (KN)
Saint Lucia (LC)
Saint Martin (MF)
Saint Vincent and the Grenadines (VC)
Samoa (WS)
San Marino (SM)
Sao Tome and Principe (ST)
Saudi Arabia (SA)
Senegal (SN)
Serbia (RS)
Seychelles (SC)
Sierra Leone (SL)
Singapore (SG)
Slovakia (SK)
Slovenia (SI)
Solomon Islands (SB)
Somalia (SO)
South Africa (ZA)
South Georgia and the South Sandwich Islands (GS)
South Korea (KR)
South Sudan (SS)
Spain (ES)
Sri Lanka (LK)
Sudan (SD)
Suriname (SR)
Swaziland (SZ)
Sweden (SE)
Switzerland (CH)
Syria (SY)
Taiwan (TW)
Tajikistan (TJ)
Tanzania (TZ)
Thailand (TH)
Togo (TG)
Tokelau (TK)
Tonga (TO)
Trinidad and Tobago (TT)
Tunisia (TN)
Turkey (TR)
Turkmenistan (TM)
Turks and Caicos Islands (TC)
Tuvalu (TV)
U.S. Virgin Islands (VI)
Uganda (UG)
Ukraine (UA)
United Arab Emirates (AE)
United Kingdom (GB)
United States (US)
Uruguay (UY)
Uzbekistan (UZ)
Vanuatu (VU)
Vatican (VA)
Venezuela (VE)
Vietnam (VN)
Wallis and Futuna (WF)
Western Sahara (EH)
Yemen (YE)
Zambia (ZM)
Zimbabwe (ZW)

Cascading parameters

BitParams with a BitFlagParams sets defaults for every flag under it - the size, the shape, the image source, the naming; a flag's own value wins (the last one turns rounding off). The country, Alt, Title, Src and the callbacks are not cascaded.

Canada
Germany
Japan
Brazil

Size

Size picks one of the theme's icon sizes (Medium, 16px, is the default); Width and Height win over it. Past these sizes, an ImageSet, the emoji or a vector Src stays sharp where the 16px packaged image blurs.

Small
Medium
Large
Width="4rem" Height="2rem"

Style & Class

Style and Class reach the frame; Styles and Classes reach each part: Root, Image, Emoji and Fallback. The --bit-Flag-* variables restyle one flag through its Style, or every flag inside an element that sets them.

Style
Class
Styles
Classes
--bit-Flag-* on one flag
--bit-Flag-* on a container

RTL

Dir flips the row the flag sits in, never the flag: a mirrored flag is a different flag.

ایران
عربستان سعودی
امارات متحده عربی

CSS variables

The public custom properties this component reads off its root, for what no parameter covers.

Every variable is read with a fallback and never declared by the component, so it inherits like any other custom property: set one on :root (or in a [bit-theme] block) to restyle every instance, on any ancestor to restyle the ones inside it, or on the Style of one instance to restyle that one alone. Leave a variable unset and the component falls back to the theme token beside it.

BitFlag CSS variables

Name Default value Description
--bit-Flag-size --bit-siz-icon-md Size of a flag with no Size, Width or Height - also the size the emoji is drawn at.
--bit-Flag-radius min(--bit-shp-radius-surface, 1/8 of the size) Corner radius of a Rounded flag. The default is capped so a theme's large card corner does not turn a small flag into a pill; a value set here is taken as given.
--bit-Flag-border-width --bit-shp-brd-width Border width of a Bordered flag.
--bit-Flag-border-color --bit-clr-brd-sec Border color of a Bordered flag.
--bit-Flag-shadow --bit-shd-card Elevation of a Shadow flag.
--bit-Flag-grayscale-filter grayscale(1) Filter of a Grayscale flag, e.g. grayscale(1) opacity(0.5).
--bit-Flag-hover-opacity 0.8 Opacity of a clickable flag under the pointer.
--bit-Flag-active-opacity 0.6 Opacity of a clickable flag while pressed.
--bit-Flag-focus-color --bit-clr-pri-focus Color of the keyboard focus ring.
--bit-Flag-emoji-font-family 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif Font stack of the Emoji flag. Put a flag emoji font of the page's own first to draw flags where the platform draws letters (Windows).

API

Every parameter, public member, sub-class and enum this component exposes.

BitFlag parameters

Name Type Default value Description
Alt string? null The accessible name of the flag. Without one the flag is decorative; with OnClick it names the button, so say what the click does.
AspectRatio string? null The aspect ratio of the frame, as any CSS aspect-ratio value (e.g. "4/3"). The height stays and the width follows - the other way round where only a Width is given. A packaged or ImageSet flag is cropped to fill it ("1" draws a square flag) unless a Fit other than Cover is set.
AutoAlt bool false Names the flag to assistive technologies with the full name of the country it resolved to. An Alt of the page's own wins over it.
AutoTitle bool false Sets the tooltip of the flag to the full name of the country it resolved to. A Title of the page's own wins over it.
Bordered bool false Draws a hairline border inside the frame, which keeps a mostly white flag visible on a white surface.
Circular bool false Clips the flag into a circle. It wins over Rounded where both are set.
Classes BitFlagClassStyles? null Custom CSS classes for different parts of the flag.
Code string? null The dialing code of the country, read like a phone number ("+31", "0031", "31"). A shared code resolves to the country owning it ("1" is the United States), so prefer an ISO code where that matters.
Country BitCountry? null The country of the flag, taken as given rather than looked up. A country of the page's own works too, and one the packaged images do not cover (the European Union) is drawn by a Src or SrcPattern. It wins over Iso2, Iso3, Code and Name.
Emoji bool false Renders the Unicode emoji flag instead of an image: no request, crisp at any size, but drawn by the platform (Windows draws the two letters of the code). It wins over Src, SrcPattern and ImageSet.
FallbackTemplate RenderFragment? null What to render when there is no flag to draw: an unknown country, or an image that failed after the packaged flag stood in for it.
Fit BitImageFit? null How the image fits a frame of another shape (a Src, SrcPattern or AspectRatio). Unset, it covers the frame and is cropped - a packaged or ImageSet flag to the flag inside its image.
Grayscale bool false Draws the flag in shades of grey, for a country that is not in play.
Height string? null The height of the flag, as any CSS length; also the width where no Width is set, and the emoji's size. It wins over Size.
ImageAttributes Dictionary<string, object> new Dictionary<string, object>() Additional HTML attributes for the img element rather than the frame, e.g. a crossorigin or referrerpolicy for a CDN. The flag's own src, alt and loading win. A srcset given here only goes with a Src or SrcPattern; it is dropped for the packaged flag and for an ImageSet, which picks its own srcset.
ImageSet BitFlagImageSet? null Draws the flag from the flat or shiny set of the Bit.BlazorUI.Assets package (16-64px), at the size the flag and the screen density need - read off Width/Height in px or rem, else Size. Also taken from a CascadingValue of a BitFlagImageSet. Emoji, Src and SrcPattern win over it.
ImageSize BitFlagImageSize? null Pins the ImageSet image to one size instead of letting the browser pick; it is still scaled to the frame. Only applies with an ImageSet.
Iso2 string? null The ISO 3166-1 alpha-2 code of the country, case insensitive; "UK" is answered with the United Kingdom ("GB"). An unknown code draws nothing rather than a broken image.
Iso3 string? null The ISO 3166-1 alpha-3 code of the country, matched case insensitively.
Loading BitImageLoading? null How the browser loads the flag image. Lazy unless set.
Name string? null The full English name of the country, case insensitive. Everyday names and abbreviations ("Czechia", "Holland", "USA") resolve too, ignoring accents and punctuation.
OnClick EventCallback<MouseEventArgs> The callback for when the flag is clicked. It makes the flag a button: in the tab order, activated by Enter and Space, with a 24px pointer target, named by its Alt or else its country.
OnError EventCallback The callback for when the flag image fails to load; fired again if the packaged flag standing in for a failed Src fails too.
OnLoad EventCallback The callback for when the flag image has loaded. Never fired for an emoji flag.
Rounded bool false Rounds the corners of the flag with the theme's surface radius, kept in proportion to the flag's size (--bit-Flag-radius overrides it). Circular wins over it where both are set.
Shadow bool false Draws the card shadow of the theme under the flag.
Size BitSize? null The size of the flag, out of the theme's icon sizes; unset, it is --bit-Flag-size, else Medium (16px). Width and Height win over it.
Src string? null The url of an image of the page's own to draw instead of the packaged flag. A failed one falls back to the packaged flag, then to the FallbackTemplate. It wins over SrcPattern and ImageSet; Emoji wins over it.
SrcPattern string? null The url of the image of every country, with {iso2}/{iso3} (lower case) or {ISO2}/{ISO3} (upper case) written in - e.g. "https://flagcdn.com/{iso2}.svg". Falls back like a Src; Src and Emoji win over it, and it wins over ImageSet.
Styles BitFlagClassStyles? null Custom CSS styles for different parts of the flag.
Title string? null The tooltip of the flag. It is not an accessible name, so a flag that must be named wants an Alt as well.
Width string? null The width of the flag, as any CSS length. A Height alone usually sets both; with a Height that is not a square, a packaged or ImageSet flag is cropped to fill the frame. It wins over Size.

BitFlag public members

Name Type Default value Description
FocusAsync ValueTask Gives focus to the flag element. Only a flag the browser can focus takes it: one with an OnClick handler, or one given a TabIndex of its own.
FocusAsync(bool preventScroll) ValueTask Gives focus to the flag element, leaving the page scrolled where it is instead of bringing the flag into view.

BitComponentBase parameters

Name Type Default value Description
AriaLabel string? null Gets or sets the accessible label for the component, used by assistive technologies.
Class string? null Gets or sets the CSS class name(s) to apply to the rendered element.
Dir BitDir? null Gets or sets the text directionality for the component's content.
Disabled bool false Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction.
ForceAnimation bool false Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested.
HtmlAttributes Dictionary<string, object> new Dictionary<string, object>() Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters.
Id string? null Gets or sets the unique identifier for the component's root element.
Style string? null Gets or sets the CSS style string to apply to the rendered element.
TabIndex string? null Gets or sets the tab order index for the component when navigating with the keyboard.
Visibility BitVisibility BitVisibility.Visible Gets or sets the visibility state (visible, hidden, or collapsed) of the component.

BitComponentBase public members

Name Type Default value Description
UniqueId Guid Guid.NewGuid() Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed.
RootElement ElementReference Gets the reference to the root HTML element associated with this component.

BitCountries properties

The table of countries the flag images and the country lookups of the library are built on. Every country is a shared BitCountry instance named after itself, so it can be written straight into markup, and the lookups below resolve any of the ways one is written down back to it - out of a dictionary rather than by scanning the table.

Name Type Default value Description
All BitCountry[] Every country the packaged flag images cover, in alphabetical order.
FindByIso2(string? iso2) BitCountry? The country carrying the ISO 3166-1 alpha-2 code, case insensitively and ignoring surrounding whitespace. "UK" is answered with the United Kingdom, whose own code is "GB".
FindByIso3(string? iso3) BitCountry? The country carrying the ISO 3166-1 alpha-3 code, case insensitively.
FindByName(string? name) BitCountry? The country carrying the English name, matched against the whole name rather than part of it. The alternative names and abbreviations a country is as widely known by are answered too, and the accents, punctuation and spacing another source spells it with are ignored.
FindByCode(string? code) BitCountry? The country carrying the dialing code, read the way a telephone number is written: "+31", "00 31" and "31" all reach the Netherlands. A shared code resolves to the country with the highest Priority ("1" is the United States, "7" Russia), else the first alphabetically.
Find(string? value) BitCountry? The country a single value stands for, read as an alpha-2 code, an alpha-3 code, a name and a dialing code in that order.
HasFlag(string? iso2) bool Whether a packaged flag image ships for the given alpha-2 code, answered without asking the network for it.
GetEmoji(string? iso2) string? The Unicode emoji flag of the given alpha-2 code, built from the pair of regional indicator symbols its letters stand for rather than looked up - so it answers for codes the packaged images do not cover, and for "GB-ENG", "GB-SCT" and "GB-WLS".

BitCountry properties

Represents the basic information of a specific country. BitCountries holds one shared instance per country - build a new one rather than editing it - and its Find methods resolve its Name, Code, Iso2 or Iso3 back to it.

Name Type Default value Description
Name string The full name of the country.
Code string The dialing code of the country, written without its leading plus sign. It is not unique: Canada and the United States both carry "1".
Iso2 string The ISO 3166-1 alpha-2 code of the country, which is what the flag image and the emoji flag are keyed by.
Iso3 string The ISO 3166-1 alpha-3 code of the country.
Priority int 0 The tie-breaker among the countries sharing a dialing code; the higher one wins (the United States over Canada for "1").
ExtraCodes string[]? null The other dialing codes the country answers to beyond Code (the Dominican Republic's "1-829" and "1-849" beside its "1-809").
DigitsCode string The Code reduced to its digits, as it appears in an E.164 number.
DigitsCodes string[] Every dialing code of the country - Code first, then ExtraCodes - reduced to its digits.
Emoji string? The flag of the country as a Unicode emoji, built from the pair of regional indicator symbols its Iso2 stands for. Null where the Iso2 is not two ASCII letters.

BitFlagClassStyles properties

Custom CSS classes/styles for the different parts of the BitFlag component.

Name Type Default value Description
Root string? null Custom CSS classes/styles for the root element of the flag, which is the frame carrying the size, the shape and the border.
Image string? null Custom CSS classes/styles for the img element, which is only rendered while the flag is drawn as an image.
Emoji string? null Custom CSS classes/styles for the element the emoji flag is written in.
Fallback string? null Custom CSS classes/styles for the element wrapping the FallbackTemplate.

BitSize enum

Name Value Description
Small 0 The small size.
Medium 1 The medium size.
Large 2 The large size.

BitFlagImageSet enum

Name Value Description
Flat 0 The flat artwork, in the same style as the packaged 16 pixel image.
Shiny 1 The shiny artwork, with a gloss and a soft edge over the flag.

BitFlagImageSize enum

Name Value Description
Size16 0 The 16 pixel image.
Size24 1 The 24 pixel image.
Size32 2 The 32 pixel image.
Size48 3 The 48 pixel image.
Size64 4 The 64 pixel image.

BitImageFit enum

Name Value Description
None 0 Neither the image nor the frame are scaled. Whatever of the image does not fit is cropped away from the right and the bottom.
Center 1 The image is not scaled, and is centered within the frame with the overflow cropped.
CenterContain 2 The image keeps its aspect ratio, is scaled down where needed so that all of it fits, and is centered in the frame.
CenterCover 3 The image keeps its aspect ratio, is scaled up where needed so that it covers the frame, and is centered in it.
Contain 4 The image keeps its aspect ratio and is fully contained within the frame. Nothing is cropped, and whatever of the frame it does not reach is left empty.
Cover 5 The image keeps its aspect ratio and fills the frame, with whatever falls outside it cropped away. This is what a flag with no Fit set does.
Fill 6 The image is stretched to fill the frame exactly, at the cost of distorting the flag where the two shapes disagree.
ScaleDown 7 The image is contained within the frame but never scaled up, so one smaller than the frame keeps its natural size.

BitImageLoading enum

Name Value Description
Eager 0 Tells the browser to load the image as soon as the img element is processed, which is what a browser does with an img that has no loading attribute.
Lazy 1 Tells the user agent to hold off on loading the image until the browser estimates that it will be needed imminently.

BitVisibility enum

Name Value Description
Visible 0 The content of the component is visible.
Hidden 1 The content of the component is hidden, but the space it takes on the page remains (visibility:hidden).
Collapsed 2 The component is hidden (display:none).

BitDir enum

Name Value Description
Ltr 0 Ltr (left to right) is to be used for languages that are written from the left to the right (like English).
Rtl 1 Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic).
Auto 2 Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.