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

Getting started

Getting started

Import one flag and retain its proportions.

Use the native API

import japan from "@johnmorrisdotca/hata/flags/jp";
import { aspectOf } from "@johnmorrisdotca/hata";
console.log(japan.startsWith("<svg"),aspectOf(japan));
true 1.5

A fixed flag import contains the SVG string, not an image URL or a DOM node. Assign it to a host element in a browser, or retain it as text on a server. Each drawing has its own module, so a page carries only the flags it imports. Set height or width while preserving the SVG viewBox; stretching can misrepresent the flag.

Choose a loading boundary

Use the root for codes, URLs and pure SVG helpers. Use /load for a code chosen at runtime, /names for captions and /manifest for source/author/licence metadata. The optional /element/define entry registers the browser element. See loading, the catalogue and framing. Installing does not add runtime dependencies or a hosted service.

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