Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@storybook/core-client
Advanced tools
Storybook framework-agnostic API
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.
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);
React Cosmos is a development tool for creating reusable React components. It allows developers to render components with different props and states, similar to Storybook. However, it focuses more on the component's environment and less on the storytelling aspect.
Docz leverages MDX to allow developers to write documentation alongside their code. It is similar to Storybook in that it provides a way to showcase components, but it focuses more on documentation and less on the isolated development environment.
The contents of this package have moved to @storybook/preview-api
. Please update your import.
This package will no longer be released as part of the 8.0 release of storybook.
FAQs
Storybook framework-agnostic API
The npm package @storybook/core-client receives a total of 1,974,306 weekly downloads. As such, @storybook/core-client popularity was classified as popular.
We found that @storybook/core-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.