Installation
npm install --save @types/vite-plugin-react-svg
Summary
This package contains type definitions for vite-plugin-react-svg (https://github.com/visualfanatic/vite-svg).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/vite-plugin-react-svg.
index.d.ts
import * as React from "react";
import { OptimizeOptions } from "svgo";
import { Plugin } from "vite";
interface Options {
/**
* Default behavior when importing `.svg` files, possible options are: `url` and `component`.
*
* Default value: `url`
*/
defaultExport?: "url" | "component";
/** Boolean flag to enable/disable SVGO */
svgo?: boolean;
/** Specify SVGO config */
svgoConfig?: OptimizeOptions;
/** Props to be forwarded on SVG tag, possible options: `start`, `end` or `false` */
expandProps?: "start" | "end" | false;
/** Setting this to `true` will forward ref to the root SVG tag */
ref?: boolean;
/** Setting this to `true` will wrap the exported component in `React.memo` */
memo?: boolean;
/**
* Replace an attribute value by another.
* The main usage of this option is to change an icon color to `currentColor` in order to inherit from text color.
*/
replaceAttrValues?: Record<string, unknown>;
/** Add props to the root SVG tag */
svgProps?: React.SVGAttributes<SVGSVGElement>;
/** Add title tag via `title` property */
titleProp?: boolean;
}
declare function reactSvgPlugin(options?: Options): Plugin;
export = reactSvgPlugin;
Additional Details
- Last updated: Tue, 07 Nov 2023 15:11:36 GMT
- Dependencies: @types/node, @types/react, @types/svgo, vite
Credits
These definitions were written by Priyanshu Rav.