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
| Name | Type | Description |
|---|---|---|
id | string |
|
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). |
svg | string | The SVG text: allowed elements and attributes only (see |
group (optional) | string | undefined | What it is listed under; |
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-fcWhat it prints (run when this page was built)