react-svg
Version:
A React component that injects SVG into the DOM.
29 lines (24 loc) • 806 B
text/typescript
import type { BeforeEach, EvalScripts } from '@tanem/svg-injector'
import type * as React from 'react'
interface BaseProps {
afterInjection?: (svg: SVGSVGElement) => void
beforeInjection?: BeforeEach
desc?: string
evalScripts?: EvalScripts
fallback?: React.ElementType
httpRequestWithCredentials?: boolean
loading?: React.ElementType
loadingDelay?: number
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.HTMLAttributes<HTMLWrapperType> &
React.SVGAttributes<SVGWrapperType>