UNPKG

react-svg

Version:

A React component that injects SVG into the DOM.

27 lines (26 loc) 931 B
import { BeforeEach, EvalScripts } from '@tanem/svg-injector'; import * as React from 'react'; interface BaseProps { afterInjection?: (svg: SVGSVGElement) => void; beforeInjection?: BeforeEach; desc?: string; evalScripts?: EvalScripts; fallback?: React.ElementType; httpRequestWithCredentials?: boolean; loading?: React.ElementType; onError?: (error: unknown) => void; renumerateIRIElements?: boolean; src: string; title?: string; useRequestCache?: boolean; wrapper?: 'div' | 'span' | 'svg'; } type HTMLWrapperType = HTMLSpanElement | HTMLDivElement; type SVGWrapperType = SVGSVGElement; export type WrapperType = HTMLWrapperType | SVGWrapperType; export type Props = BaseProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLWrapperType>, HTMLWrapperType> & React.SVGProps<SVGWrapperType>; export interface State { hasError: boolean; isLoading: boolean; } export {};