Back to Docusaurus

📦 plugin-svgr

website/versioned_docs/version-3.9.2/api/plugins/plugin-svgr.mdx

3.10.11.0 KB
Original Source

📦 plugin-svgr

import APITable from '@site/src/components/APITable';

An SVGR plugin to transform SVG files into React components automatically at build time.

Installation

bash
npm install --save @docusaurus/plugin-svgr

:::tip

If you use the preset @docusaurus/preset-classic, you don't need to install this plugin as a dependency.

You can configure this plugin through the preset options.

:::

Configuration

Accepted fields:

mdx-code-block
<APITable>
NameTypeDefaultDescription
svgrConfigobject{}The SVGR config options, forwarded as is
mdx-code-block
</APITable>

Example configuration

You can configure this plugin through plugin options.

js
// Preset Options: svgr
// Plugin Options: @docusaurus/plugin-svgr

const config = {
  svgrConfig: {
    /* SVGR config */
  },
};