本文へ移動

Hata旗

国や地域の旗を読み込み、対応する表示の形を選び、絵ごとの資料・作者・ライセンスを保てます。

「旗(はた)」は、旗を表す日本語です。 名前について(英語)

目次

リファレンス · /bind

FlagProps型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What a binding's flag takes: the same as <hata-flag>'s attributes. Every field but code may be left out.

インポート

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

ほかのエクスポート元: @johnmorrisdotca/hata/react, @johnmorrisdotca/hata/vue

定義

interface FlagProps {
    code: string;
    shape?: "own" | "flag" | "4:3" | "1:1" | "round";
    fit?: Fit;
    size?: "small" | "medium" | "large" | number | string;
    width?: number | string;
    label?: string;
    lang?: "en" | "ja";
    border?: boolean;
    shadow?: boolean;
    theme?: "auto" | "light" | "dark";
    date?: string | Date;
    variant?: string;
    which?: FlagRole;
    allowRestricted?: boolean;
}

メンバー

名前型説明
codestring

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

shape (省略可)"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 (省略可)Fit | undefined

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

size (省略可)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 (省略可)string | number | undefined

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

label (省略可)string | undefined

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

lang (省略可)"en" | "ja" | undefined

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

border (省略可)boolean | undefined

A hairline round the flag, so a white flag shows on a white page.

shadow (省略可)boolean | undefined

A soft shadow under it.

theme (省略可)"auto" | "light" | "dark" | undefined

auto (the default), light or dark: the colour of the border on a light or a dark page.

date (省略可)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.

variant (省略可)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.

which (省略可)FlagRole | undefined

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

allowRestricted (省略可)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.

例

import { preloadFlags, type FlagProps } from "@johnmorrisdotca/hata/bind";

const tokyo: FlagProps = { code: "JP-13", shape: "round", size: "medium", label: "Tokyo" };
await preloadFlags([tokyo]);

ソースを見るGitHub で編集@johnmorrisdotca/hata 1.31.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。