• Version 4.1.3
  • Published
  • 132 kB
  • 1 dependency
  • MIT license


npm i react-inlinesvg
yarn add react-inlinesvg
pnpm add react-inlinesvg


An SVG loader for React



variable cacheStore

let cacheStore: CacheStore;

    variable STATUS

    const STATUS: {
    readonly IDLE: 'idle';
    readonly LOADING: 'loading';
    readonly LOADED: 'loaded';
    readonly FAILED: 'failed';
    readonly READY: 'ready';
    readonly UNSUPPORTED: 'unsupported';


      function InlineSVG

      InlineSVG: typeof InlineSVG;

        function InlineSVG

        InlineSVG: typeof InlineSVG;


          interface FetchError

          interface FetchError extends Error {}

            property code

            code: string;

              property errno

              errno: string;

                property message

                message: string;

                  property type

                  type: string;

                    interface State

                    interface State {}

                      property content

                      content: string;

                        property element

                        element: React.ReactNode;

                          property isCached

                          isCached: boolean;

                            property status

                            status: Status;

                              interface StorageItem

                              interface StorageItem {}

                                property content

                                content: string;

                                  property status

                                  status: Status;

                                    Type Aliases

                                    type ErrorCallback

                                    type ErrorCallback = (error: Error | FetchError) => void;

                                      type LoadCallback

                                      type LoadCallback = (src: string, isCached: boolean) => void;

                                        type PlainObject

                                        type PlainObject<T = unknown> = Record<string, T>;

                                          type PreProcessorCallback

                                          type PreProcessorCallback = (code: string) => string;

                                            type Props

                                            type Props = Simplify<
                                            Omit<React.SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> & {
                                            baseURL?: string;
                                            cacheRequests?: boolean;
                                            children?: React.ReactNode;
                                            description?: string;
                                            fetchOptions?: RequestInit;
                                            innerRef?: React.Ref<SVGElement>;
                                            loader?: React.ReactNode;
                                            onError?: ErrorCallback;
                                            onLoad?: LoadCallback;
                                            preProcessor?: PreProcessorCallback;
                                            src: string;
                                            title?: string | null;
                                            uniqueHash?: string;
                                            uniquifyIDs?: boolean;

                                              type Simplify

                                              type Simplify<T> = {
                                              [KeyType in keyof T]: T[KeyType];
                                              } & {};

                                                type Status

                                                type Status = (typeof STATUS)[keyof typeof STATUS];

                                                  Package Files (1)

                                                  Dependencies (1)

                                                  Dev Dependencies (29)

                                                  Peer Dependencies (1)


                                                  To add a badge like this badgeto your package's README, use the codes available below.

                                                  You may also use to create a custom badge linking to

                                                  • Markdown
                                                  • HTML
                                                    <a href=""><img src="" alt=""></a>