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
| Name | Type | Description |
|---|---|---|
svg | string | A flag's SVG string ( |
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)