UNPKG

react-lazy-svg

Version:

react-lazy-svg is a simple way to use SVGs with the performance benefits of a sprite-sheet and svg css styling possibilities. Without bloating the bundle. It automatically creates a sprite-sheet for all used SVGs on the client but also provides the option

19 lines (18 loc) 685 B
import type { FC, ReactNode, SVGProps } from 'react'; import { IconData } from './types'; export { IconData }; export declare type IconsCache = Map<string, IconData | Promise<IconData | undefined>>; export interface SpriteContext { /** * asynchronous function to load an svg string by url */ loadSVG: (url: string) => Promise<string | undefined>; knownIcons?: IconsCache; embeddedSSR?: boolean; children?: ReactNode; } export declare const SpriteContextProvider: FC<SpriteContext>; export declare const Icon: FC<{ url: string; } & SVGProps<SVGSVGElement>>; export declare const initOnClient: (knownIcons?: IconsCache, spriteSheetId?: string) => void;