本文へ移動

Hata旗

国や地域の旗を読み込み、対応する表示の形を選び、絵ごとの資料・作者・ライセンスを保てます。

「旗(はた)」は、旗を表す日本語です。 名前について(英語)

目次

リファレンス · /bind

inlineSvg関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { inlineSvg } from "@johnmorrisdotca/hata/bind";

定義

function inlineSvg(svg: string): string

引数

名前型説明
svgstring

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

戻り値

string

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

例

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>

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hata 1.31.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。