Socket
Socket
Sign inDemoInstall

@storybook/core-client

Package Overview
Dependencies
250
Maintainers
5
Versions
756
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @storybook/core-client

Storybook framework-agnostic API


Version published
Weekly downloads
4.6M
decreased by-1.51%
Maintainers
5
Created
Weekly downloads
 

Package description

What is @storybook/core-client?

The @storybook/core-client npm package is a part of the Storybook ecosystem, which is an open-source tool for developing UI components in isolation for React, Vue, Angular, and more. It provides the core functionalities required to run and manage the Storybook client, including rendering stories, managing the UI and state, and integrating with the Storybook ecosystem.

What are @storybook/core-client's main functionalities?

Rendering Stories

This feature allows developers to write stories that represent different states of UI components. The code sample shows how to use the Storybook API to define stories for a 'Button' component with different content.

import { storiesOf } from '@storybook/react';

storiesOf('Button', module)
  .add('with text', () => <button>Hello Button</button>)
  .add('with emoji', () => <button>😀 😎 👍 💯</button>);

Managing UI State

This feature allows addons to interact with the Storybook UI and react to events such as when a story changes. The code sample demonstrates how to register an addon that listens for the STORY_CHANGED event.

import { addons } from '@storybook/addons';
import { STORY_CHANGED } from '@storybook/core-events';

addons.register('my-addon', (api) => {
  api.on(STORY_CHANGED, (storyId) => {
    console.log('Current story is', storyId);
  });
});

Integrating with Storybook Ecosystem

This feature enables the integration of various Storybook addons to enhance the development experience. The code sample shows how to add the 'withKnobs' decorator from the '@storybook/addon-knobs' package to enable dynamic properties for components.

import { addDecorator } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';

addDecorator(withKnobs);

Other packages similar to @storybook/core-client

Readme

Source

Storybook Core-Client

This package contains browser-side functionality shared amongst all the frameworks (React, RN, Vue, Ember, Angular, etc) in the old "v6" story store back-compatibility layer.

A framework calls the start(renderToDom, { render, decorateStory }) function and provides:

  • The renderToDom function, which tells Storybook how to render the result of a story function to the DOM
  • The render function, which is a default mapping of args to a story result in CSFv3
  • The decorateStory function, which tells Storybook how to combine decorators in the framework.

The start function will return a configure() function, which can be re-exported to be used in preview.js (deprecated), or automatically by the main.js:stories field to:

  • return a list of CSF files
  • [deprecated] make calls to the storiesOf API.

Keywords

FAQs

Last updated on 13 Jun 2022

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc