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/blocks
Advanced tools
@storybook/blocks is a package designed to enhance the Storybook experience by providing a set of reusable blocks for building and organizing stories. It allows developers to create more structured and maintainable storybooks with ease.
Creating Stories
This feature allows you to create and organize stories for your components. The code sample demonstrates how to define a story for a Button component using the Story and Meta blocks.
import { Story, Meta } from '@storybook/blocks';
export default {
title: 'Example/Button',
component: Button,
} as Meta;
const Template: Story<ButtonProps> = (args) => <Button {...args} />;
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Button',
};
Adding Controls
This feature allows you to add controls to your stories, enabling dynamic interaction with component properties. The code sample shows how to add a color control for the backgroundColor property of a Button component.
import { Story, Meta } from '@storybook/blocks';
export default {
title: 'Example/Button',
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
} as Meta;
const Template: Story<ButtonProps> = (args) => <Button {...args} />;
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Button',
};
Documentation
This feature allows you to add documentation to your stories, making it easier for other developers to understand and use your components. The code sample demonstrates how to configure documentation for a Button component using DocsPage and DocsContainer.
import { Meta, Story, DocsPage, DocsContainer } from '@storybook/blocks';
export default {
title: 'Example/Button',
component: Button,
parameters: {
docs: {
container: DocsContainer,
page: DocsPage,
},
},
} as Meta;
const Template: Story<ButtonProps> = (args) => <Button {...args} />;
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Button',
};
react-docgen is a CLI and library for extracting information from React components for documentation generation. It focuses on generating documentation from React components' source code, making it a good alternative for creating detailed component documentation.
docz is a tool for creating beautiful and highly customizable documentation sites for your React components. It provides a similar experience to Storybook but with a stronger emphasis on creating full-fledged documentation sites.
Portable documentation components for building design systems in Storybook.
To bootstrap, in the monorepo root:
yarn start
To develop this package, in the monorepo root:
yarn build blocks --watch
To run storybook, in this directory:
yarn storybook
7.0.24
file-system-cache
to 2.3.0 - #23221, thanks @JReinhold!FAQs
Storybook Doc Blocks
The npm package @storybook/blocks receives a total of 3,845,585 weekly downloads. As such, @storybook/blocks popularity was classified as popular.
We found that @storybook/blocks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 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.