Socket
Book a DemoInstallSign in
Socket

storybook-preset-inline-svg

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-preset-inline-svg

Storybook preset to load SVG files inline

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
7.9K
-2.42%
Maintainers
1
Weekly downloads
 
Created
Source

storybook-preset-inline-svg

A Storybook preset to load SVG files inline using svg-inline-loader.

Basic Usage

First npm install storybook-preset-inline-svg svg-inline-loader

Storybook 10+ uses ESM-only config. Update .storybook/main.ts (or .storybook/main.js):

export default {
  addons: ['storybook-preset-inline-svg'],
}

TypeScript example with types:

import type { StorybookConfig } from '@storybook/react'

const config: StorybookConfig = {
  addons: ['storybook-preset-inline-svg'],
}

export default config

Advanced Usage

By default this preset will inline all SVG files. Use options to filter which SVG files are inlined, or to pass options along to svg-inline-loader.

None of the options are required. Only use one of include or exclude, not both, which can be a RegExp or Function.

  • svgInlineLoaderOptions options supported by svg-inline-loader
  • include files to be inlined using include
  • exclude files from being inlined using exclude

For example,

export default {
  addons: [
    {
      name: 'storybook-preset-inline-svg',
      options: {
        include: /source\/.+\.svg$/,
        svgInlineLoaderOptions: {
          removeTags: true,
          removingTags: ['circle'],
        },
      },
    },
  ],
}

Keywords

storybook

FAQs

Package last updated on 28 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts