Socket
Socket
Sign inDemoInstall

@storybook/blocks

Package Overview
Dependencies
23
Maintainers
29
Versions
701
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/blocks


Version published
Maintainers
29
Created

Package description

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

Changelog

Source

7.0.0-alpha.57 (December 3, 2022)

Bug Fixes
  • Vite: Reinstate (deprecated) StorybookViteConfig #20057
  • Docs: using targeted styles, not components to style MDX #19958
  • Docs: Return to filtering toolbars in docs mode, but don't filter menu #19959
  • Angular: Don't set argType.defaultValue in angular/compodoc #19935
  • NextJS: Support next/image component in v12/13 properly #20028
  • Svelte: Use JSDocs in JS CLI templates and put manual enum arg type back as it is not inferred #20042
Maintenance
  • CLI: Add a new version-update check telemetry event #20074
  • CLI: Add upgrade telemetry details #20064
  • Core: added .entries property to error thrown when duplicate stories are present #20038
Build
  • Improve framework version specific story handling #20027
  • Fix repro templates script #20063
  • Build: replace image placeholder url in example stories for nextjs #20069
  • Build: improve inDevelopment mode for yarn task #20067
  • Build: revamp interactions e2e test #20060
Dependency Upgrades
  • Build: Update jest pretty-format to 29 #20047

Readme

Source

Storybook Doc Blocks

Portable documentation components for building design systems in Storybook.

Blocks development

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

Keywords

FAQs

Last updated on 03 Dec 2022

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc