Skip to content

pantoken-root / formats/icon-font/src / svgToGlyphPath

Fonksyon: svgToGlyphPath() ​

svgToGlyphPath(svg): GlyphPath

Beta

Pwodui yon chemen glif ranpli pou yon SVG ikon.

Paramèt ​

svg ​

string

Makaj SVG an liy.

Retounen ​

GlyphPath

Chemen ranpli a d (nan kowòdone viewBox) ak gwosè viewBox la.

Egzanp ​

Fè yon kontou pou yon ikon ki baze sou stroke (Lucide) ak yon ikon ki baze sou ranpli

ts
import { svgToGlyphPath } from "@pantoken/icon-font";
import { getIcon } from "@pantoken/icons";

const { d, width, height } = svgToGlyphPath(getIcon("arrow-left")!.svg);
// d: a single filled path; width/height: the viewBox size (e.g. 24, 24)