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

Reference · /bind

inlineSvgfunction

The flag's SVG made to fill the span that holds it, and hidden from a screen reader (the span carries the name): what the web bindings put inside the span as HTML.

Import it

import { inlineSvg } from "@johnmorrisdotca/hata/bind";

Definition

function inlineSvg(svg: string): string

Parameters

NameTypeDescription
svgstring

A flag's SVG string (BoundFlag.svg).

Returns

string

The SVG with a style that fills its box, aria-hidden and focusable="false".

Examples

import { inlineSvg } from "@johnmorrisdotca/hata/bind";

console.log(inlineSvg("<svg viewBox=\"0 0 3 2\"></svg>")); // <svg style="display:block;width:100%;height:100%" aria-hidden="true" focusable="false" viewBox="0 0 3 2"></svg>
<svg style="display:block;width:100%;height:100%" aria-hidden="true" focusable="false" viewBox="0 0 3 2"></svg>

What it prints (run when this page was built)

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