Reference · On-demand flag loading
FrameOptionstype
How to frame a flag: its shape, how it fits, and a label for assistive technology. Every field may be left out.
Import it
import type { FrameOptions } from "@johnmorrisdotca/hata/load";
Also exported from: @johnmorrisdotca/hata
Definition
interface FrameOptions {
shape?: Shape;
fit?: Fit;
label?: string;
}
Members
| Name | Type | Description |
|---|---|---|
shape (optional) | Shape | undefined | The frame's shape: |
fit (optional) | Fit | undefined |
|
label (optional) | string | undefined | A name for assistive technology. With one, the SVG gets |
Examples
import { frame, type FrameOptions } from "@johnmorrisdotca/hata";
import france from "@johnmorrisdotca/hata/flags/fr";
const avatar: FrameOptions = { shape: "round", label: "France" };
console.log(frame(france, avatar));<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="France"><title>France</title><defs><clipPath id="hata-round-yob49r"><circle cx="256" cy="256" r="256"/></clipPath></defs><g clip-path="url(#hata-round-yob49r)"><svg data-hata="fr" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" x="0" y="0" width="512" height="512" preserveAspectRatio="xMidYMid slice"><path fill="#ce1126" d="M0 0h900v600H0"/><path fill="#fff" d="M0 0h600v600H0"/><path fill="#002654" d="M0 0h300v600H0"/></svg></g></svg>What it prints (run when this page was built)