Socket
Book a DemoInstallSign in
Socket

@storybook/addon-design-assets

Package Overview
Dependencies
Maintainers
5
Versions
510
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-design-assets

Design asset preview for storybook

latest
Source
npmnpm
Version
6.2.9
Version published
Weekly downloads
972
123.96%
Maintainers
5
Weekly downloads
 
Created
Source

Storybook addon for design assets

This addon for storybook allows you to link to image files, other files, and even url's for embedding in the storybook panel!

You can add as many assets to a single story as you want.

Install

npm install @storybook/addon-design-assets

Usage

within .storybook/main.js:

module.exports = {
  addons: ['@storybook/addon-design-assets']
}

within your stories:

import React from 'react';

import imageUrl from './images/my-image.jpg'; 

export default {
  title: 'Design Assets',
  parameters: {
    assets: [
      imageUrl, // link to a file imported
      'https://via.placeholder.com/300/09f/fff.png', // link to an external image
      'https://www.example.com', // link to a webpage
      'https://www.example.com?id={id}', // link to a webpage with the current story's id in the url
    ],
  },
};

export const defaultView = () => (
  <div>your story here</div>
);

Keywords

addon

FAQs

Package last updated on 23 Apr 2021

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