🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@etchteam/storybook-addon-status

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etchteam/storybook-addon-status

Add component status to the storybook UI

Source
npmnpm
Version
5.0.0
Version published
Weekly downloads
66K
-29.1%
Maintainers
4
Weekly downloads
 
Created
Source

Storybook Addon Status

Storybook Status Addon can be used to add a component status label in Storybook.

React Storybook Screenshot

Installation

npm install @etchteam/storybook-addon-status --save-dev

Configuration

Then create a file called main.js in your storybook config.

Add the following content to it:

export default {
  addons: ['@etchteam/storybook-addon-status'],
};

In preview.js you can globally configure custom status configurations, or overwrite the built in "beta", "deprecated", "stable" & "releaseCandidate"

export default {
  parameters: {
    status: {
      statuses: {
        released: {
          background: '#0000ff',
          color: '#ffffff',
          description: 'This component is stable and released',
        },
      },
    },
  }
};

Story Usage

Then write your stories like this:

.js


export default {
  title: 'BetterSoftwareLink',
  parameters: {
    status: {
      type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
      url: 'http://www.url.com/status', // will make the tag a link
      statuses: {...} // add custom statuses for this story here
    }
  },
};

export const Default = () => (
  <a href="https://makebetter.software">Make Better Software</a>
);

For multiple statuses type also accepts array values.

If not specifically set every status uses status.url as the linked Url.

export default {
  parameters: {
    status: {
      type: [
        'beta',
        'released',
        'myCustomStatus',
        {
          name: 'stable',
          url: 'http://www.example.com'
        }
      ],
      // url, statuses ..
    },
  },
}

NOTE: The status dot in the sidebar only shows the color of the first status.

.mdx (using addon-docs)

import { Meta } from "@storybook/addon-docs/blocks";

<Meta
  title="BetterSoftwareLink"
  parameters={{ status: { type: 'beta' } }}
/>

You'll get a label injected in the top toolbar and the sidebar.

Note the type will be used as label for tag and will convert camelCase to words

Migration guide

Need to update your major version?

Made with ☕ at Etch

Keywords

storybook

FAQs

Package last updated on 28 May 2024

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