FlagPropstype
What a binding's flag takes: the same as <hata-flag>'s attributes. Every field but code may be left out.
Import it
import type { FlagProps } from "@johnmorrisdotca/hata/bind";
Also exported from: @johnmorrisdotca/hata/react, @johnmorrisdotca/hata/vue
Definition
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;
}
Members
| Name | Type | Description |
|---|---|---|
code | string | The flag's code, in any case: "JP", "jp-13", "CA-ON", "DE-BY". |
shape (optional) | "flag" | "4:3" | "1:1" | "round" | "own" | undefined |
|
fit (optional) | Fit | undefined | How it fits a frame: |
size (optional) | string | number | undefined | Its height: |
width (optional) | string | number | undefined | A width in pixels, with the height following the flag's proportions; overrides |
label (optional) | string | undefined | What a screen reader says. Left out, the place's name in |
lang (optional) | "en" | "ja" | undefined |
|
border (optional) | boolean | undefined | A hairline round the flag, so a white flag shows on a white page. |
shadow (optional) | boolean | undefined | A soft shadow under it. |
theme (optional) | "auto" | "light" | "dark" | undefined |
|
date (optional) | string | Date | undefined | The day whose flag to draw: |
variant (optional) | string | undefined | Which of the place's flags in real use to draw, by its |
which (optional) | FlagRole | undefined | With |
allowRestricted (optional) | 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. |
Examples
import { preloadFlags, type FlagProps } from "@johnmorrisdotca/hata/bind";
const tokyo: FlagProps = { code: "JP-13", shape: "round", size: "medium", label: "Tokyo" };
await preloadFlags([tokyo]);