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 · /bind

BoundFlagtype

A flag ready to draw: its SVG with a style that fills the box, its proportions and the name a screen reader says.

Import it

import type { BoundFlag } from "@johnmorrisdotca/hata/bind";

Also exported from: @johnmorrisdotca/hata/react, @johnmorrisdotca/hata/vue

Definition

interface BoundFlag {
    svg: string;
    name: string;
    aspect: number;
}

Members

NameTypeDescription
svgstring

The flag's SVG, as the package ships it (framed as asked). inlineSvg makes it fill a span.

namestring

What a screen reader says: label, or the place's name.

aspectnumber

Width over height.

Examples

import { resolveFlag, type BoundFlag } from "@johnmorrisdotca/hata/bind";

const found: BoundFlag | null = await resolveFlag({ code: "JP" });
console.log(found?.name, found?.aspect); // "Japan" 1.5
Japan 1.5

What it prints (run when this page was built)

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