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

@storybook/addon-actions

Package Overview
Dependencies
Maintainers
11
Versions
1970
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-actions

Get UI feedback when an action is performed on an interactive element

  • 0.0.0-pr-29659-sha-1f47b682
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.7M
decreased by-2.57%
Maintainers
11
Weekly downloads
 
Created

What is @storybook/addon-actions?

The @storybook/addon-actions package is a Storybook addon that allows you to log interactions with your UI components. It is useful for debugging and for getting feedback on how components respond to user actions. With this addon, you can capture events and their payloads, making it easier to understand the behavior of your components during development.

What are @storybook/addon-actions's main functionalities?

Log Actions

This feature allows you to log actions in the Storybook UI. When the button is clicked, the 'button-click' action is logged, showing the event and its payload.

import { action } from '@storybook/addon-actions';

export default {
  title: 'Button',
  argTypes: { onClick: { action: 'clicked' } },
};

export const TextButton = () => (
  <button onClick={action('button-click')}>Hello Button</button>
);

Customize Output

This feature allows you to customize the output of the action logger. In this example, the default behavior of the click event is prevented, and a custom label is used for logging.

import { action } from '@storybook/addon-actions';

const createClickHandler = (label) => action(label, (e) => e.preventDefault());

export const PreventDefaultButton = () => (
  <button onClick={createClickHandler('prevent-default-click')}>Click Me</button>
);

Other packages similar to @storybook/addon-actions

Keywords

FAQs

Package last updated on 20 Nov 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