Socket
Socket
Sign inDemoInstall

@storybook/react

Package Overview
Dependencies
Maintainers
9
Versions
1856
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/react

Storybook React renderer


Version published
Weekly downloads
4.1M
decreased by-11.25%
Maintainers
9
Weekly downloads
 
Created

Package description

What is @storybook/react?

@storybook/react is a development environment for UI components. It allows developers to create components independently and showcase components interactively in an isolated development environment. Storybook helps in building UI components in isolation from the business logic and context of the app, which makes it easier to develop hard-to-reach states and edge cases.

What are @storybook/react's main functionalities?

Component Story Format (CSF)

CSF is an ES Module-based standard for defining component examples. This format is simple and portable. Developers can write their component stories in plain JavaScript objects.

import React from 'react';
import { Button } from './Button';

export default {
  title: 'Example/Button',
  component: Button,
};

const Template = (args) => <Button {...args} />;

export const Primary = Template.bind({});
Primary.args = {
  primary: true,
  label: 'Button',
};

Addons

Addons are essentially plugins that extend Storybook's core functionalities. With addons, developers can add features like knobs to dynamically change props, accessibility checks, and story source code display.

import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';

export default {
  title: 'Example/Button',
  decorators: [withKnobs],
};

export const DynamicVariables = () => {
  const name = text('Name', 'Aragon');
  const age = number('Age', 30);
  const content = `I am ${name} and I'm ${age} years old.`;
  return <div>{content}</div>;
};

Controls

Controls give the ability to interact with a component's arguments dynamically without needing to code. It's a more robust version of the addon-knobs but built into Storybook by default.

export default {
  title: 'Example/Button',
  component: Button,
  argTypes: {
    backgroundColor: { control: 'color' },
    size: {
      control: { type: 'select', options: ['small', 'medium', 'large'] },
    },
  },
};

export const Primary = (args) => <Button {...args} />;
Primary.args = {
  primary: true,
  label: 'Button',
};

Other packages similar to @storybook/react

Changelog

Source

8.0.9

  • Addon-docs: Fix MDX compilation when using @vitejs/plugin-react-swc with plugins - #26837, thanks @JReinhold!
  • CSF: Fix typings for control and other properties of argTypes - #26824, thanks @kasperpeulen!
  • Controls: Fix crashing when docgen extraction partially fails - #26862, thanks @yannbf!
  • Doc Tools: Signature Type Error Handling - #26774, thanks @ethriel3695!
  • Next.js: Move sharp into optional deps - #26787, thanks @shuta13!
  • Nextjs: Support next 14.2 useParams functionality - #26874, thanks @yannbf!
  • Test: Remove chai as dependency of @storybook/test - #26852, thanks @kasperpeulen!
  • UI: Fix sidebar search hanging when selecting a story in touch mode - #26807, thanks @JReinhold!

Readme

Source

Storybook React renderer

Keywords

FAQs

Package last updated on 22 Apr 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc