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 · Flags a page registers itself

CustomFlagRecordtype

One custom flag a page gives: its id (custom: and a slug), its name, its SVG and, if it likes, a group to be listed under.

Import it

import type { CustomFlagRecord } from "@johnmorrisdotca/hata/custom";

Definition

interface CustomFlagRecord {
    id: string;
    name: {
        en: string;
        ja?: string;
    };
    svg: string;
    group?: string;
}

Members

NameTypeDescription
idstring

custom: and a slug: lower-case letters, digits and hyphens, up to 48 characters.

name{ en: string; ja?: string; }

The name for a caption or a screen reader; the Japanese one may be left out (the English is used).

svgstring

The SVG text: allowed elements and attributes only (see registerFlags), with a viewBox and no width or height.

group (optional)string | undefined

What it is listed under; "custom" when left out.

Examples

import type { CustomFlagRecord } from "@johnmorrisdotca/hata/custom";

const club: CustomFlagRecord = {
  id: "custom:harbour-fc",
  name: { en: "Harbour FC", ja: "ハーバーFC" },
  group: "Clubs",
  svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3 2"><path fill="#036" d="M0 0h3v2H0z"/></svg>',
};
console.log(club.id);
custom:harbour-fc

What it prints (run when this page was built)

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