Skip to the content

Hata旗

Load a native country or region flag, choose supported framing and keep each drawing’s source, author and licence.

Hata (旗) is Japanese for a flag. About the name

Contents

Reference · /react-native

NativeFlagPropstype

What a native flag takes: <hata-flag>'s code, shape, fit, label, lang, date, variant, which and allowRestricted, and a size (small, medium, large or a number of points, 24 by default) for its height, or a width.

Import it

import type { NativeFlagProps } from "@johnmorrisdotca/hata/react-native";

Definition

type NativeFlagProps = Pick<FlagProps, "code" | "shape" | "fit" | "label" | "lang" | "date" | "variant" | "which" | "allowRestricted" | "size" | "width">;

Members

NameTypeDescription
variant (optional)string | undefined

Which of the place's flags in real use to draw, by its id from variantsOf(code): de-facto, stripes, local. Martinique's local is deprecated, an alias of martinique until 2.0.

date (optional)string | Date | undefined

The day whose flag to draw: "1962-09-29", "1962-09", "1962" or a Date. The variant wins where both are given.

allowRestricted (optional)boolean | undefined

Draw a flag whose display the law restricts (Germany's of 1935 to 1945), for history and education. Without it nothing is drawn.

shape (optional)"flag" | "4:3" | "1:1" | "round" | "own" | undefined

own (the default: its own proportions), 4:3, 1:1 or round, framed as flag(code, { shape }) frames it.

fit (optional)Fit | undefined

How it fits a frame: auto (the default), whole, crop, cover, hoist or contain, as frame() takes them.

label (optional)string | undefined

What a screen reader says. Left out, the place's name in lang.

codestring

The flag's code, in any case: "JP", "jp-13", "CA-ON", "DE-BY".

size (optional)string | number | undefined

Its height: small, medium or large (24, 48 or 96 pixels), or a number of pixels. Left out, 1em, the height of the text around it.

width (optional)string | number | undefined

A width in pixels, with the height following the flag's proportions; overrides size.

which (optional)FlagRole | undefined

With date: legal (the default) or in-use. (Not role, which is the ARIA role of the element.)

lang (optional)"en" | "ja" | undefined

en or ja, the language of the name read out. Left out, English.

Examples

import type { NativeFlagProps } from "@johnmorrisdotca/hata/react-native";

const props: NativeFlagProps = { code: "JP", size: "medium", label: "Japan" };
console.log(props.code);
JP

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hata 1.31.0.