Skip to the content

Kuni国

Look up countries, codes, names and subdivisions, load country data on demand and mount a native country card.

Kuni (国) is Japanese for a country. About the name

Contents

Reference · Country card element

KuniCardOptionstype

Host SVG loaders and native map appearance; attributes override drawing defaults.

Import it

import type { KuniCardOptions } from "@johnmorrisdotca/kuni/element";

Also exported from: @johnmorrisdotca/kuni/element/define

Definition

interface KuniCardOptions {
    flag?: (code: string) => Promise<string | null>;
    map?: (code: string, language: "en" | "ja", drawing?: Pick<KuniCardOptions, "colors" | "capital">) => Promise<string | null>;
    colors?: Readonly<Record<string, string>>;
    capital?: boolean;
}

Members

NameTypeDescription
flag (optional)((code: string) => Promise<string | null>) | undefined

Load a Hata flag or an equivalent SVG for the ISO code; null means unavailable.

map (optional)((code: string, language: "en" | "ja", drawing?: Pick<KuniCardOptions, "colors" | "capital">) => Promise<string | null>) | undefined

Load trusted SVG for the ISO code/language, honouring optional drawing settings; null means unavailable.

colors (optional)Readonly<Record<string, string>> | undefined

Per-region CSS colours for the native drawing; code:hex-colour attribute pairs override this map.

capital (optional)boolean | undefined

Show the capital markers on the map, true by default. This does not remove the capital text field.

Examples

import { type KuniCardOptions, KUNI_CARD_OPTION_KEYS } from "@johnmorrisdotca/kuni/element";
const options: KuniCardOptions = {};
console.log(Object.keys(options).length); // 0
console.log(KUNI_CARD_OPTION_KEYS.length); // 4
0
4

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kuni 1.4.0.