Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/blocks

Package Overview
Dependencies
Maintainers
11
Versions
877
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/blocks

Storybook Doc Blocks

  • 0.0.0-pr-29434-sha-c02fe507
  • Source
  • npm
  • Socket score

Version published
Maintainers
11
Created

What is @storybook/blocks?

@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.

What are @storybook/blocks's main functionalities?

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',
};

Other packages similar to @storybook/blocks

Keywords

FAQs

Package last updated on 25 Oct 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc