Socket
Socket
Sign inDemoInstall

@storybook/core

Package Overview
Dependencies
11
Maintainers
0
Versions
1053
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @storybook/core

Storybook framework-agnostic API


Version published
Weekly downloads
1.4M
decreased by-1.44%
Maintainers
0
Created
Weekly downloads
 

Package description

What is @storybook/core?

The @storybook/core package is a part of Storybook, which is an open-source tool for developing UI components in isolation for React, Vue, Angular, and many other frameworks. It allows developers to create component libraries, interactive examples, and UI documentation. The core package is responsible for the fundamental functionalities of Storybook, including the server, UI, and the management of stories.

What are @storybook/core's main functionalities?

Custom Storybook Configuration

This code snippet demonstrates how to customize Storybook's configuration, including specifying where to find stories, which addons to use, the framework (e.g., React), and the builder (e.g., Webpack 5).

module.exports = {
  stories: ['../src/**/*.stories.js'],
  addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
  framework: '@storybook/react',
  core: {
    builder: 'webpack5'
  }
};

Adding Decorators

Decorators are a way to wrap stories with extra markup or styling. This code sample shows how to add a decorator globally in `.storybook/preview.js` that adds margin around each story.

export const decorators = [(Story) => <div style={{ margin: '3em' }}><Story/></div>];

Custom Webpack Configuration

This demonstrates how to extend Storybook's default Webpack configuration to support additional file types or loaders, in this case, adding support for SCSS files.

const path = require('path');

module.exports = {
  webpackFinal: async (config) => {
    config.module.rules.push({
      test: /\.scss$/,
      use: ['style-loader', 'css-loader', 'sass-loader'],
      include: path.resolve(__dirname, '../'),
    });
    return config;
  },
};

Other packages similar to @storybook/core

Readme

Source

Storybook Core

The @storybook/core package is the core of Storybook. It is responsible for the following:

  • the main UI of storybook
  • the UI used by addons
  • the API used by addons
  • the API used by the CLI
  • the API used by the server
  • prebundled code used by the browser
  • static assets used by the browser
  • utilities for CSF, MDX & Docs

Private package

This package is not intended to be used by anyone but storybook internally.

Even though this is where all of the code is located, it is NOT to be the entry point when using functionality within!

Consumers of the code should import like so:

import { addons } from 'storybook/manager-api';

Importing from @storybook/core is explicitly NOT supported; it WILL break in a future version of storybook, very likely in a non-major version bump.

Keywords

FAQs

Last updated on 26 Jun 2024

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc