Deprecated Storybook addon that previously provided component interaction logging; now directs users to Storybook 9.0+ migration guide
npx @tessl/cli install tessl/npm-storybook--addon-actions@9.0.0⚠️ DEPRECATION NOTICE: This package is deprecated in Storybook 9.0 and above. It has been moved into @storybook/core and no longer requires separate installation.
This package previously provided logging and display functionality for component interactions in Storybook. In current versions (9.0.8+), it only throws migration errors directing users to upgrade their Storybook configuration.
npm install @storybook/addon-actionsAll entry points now throw the following error:
throw new Error(
'Your Storybook project is referring to package @storybook/addon-actions, which no longer exists in Storybook 9.0 and above. Please refer to the Storybook 9 migration guide for instructions on how to fix this issue: https://storybook.js.org/docs/9/migration-guide#package-structure-changes'
);In Storybook 9.0+, actions functionality is built-in:
@storybook/addon-actions from dependencies.storybook/main.js addons arrayfn function from @storybook/test instead// Before (deprecated)
import { action } from '@storybook/addon-actions';
// After (Storybook 9.0+)
import { fn } from '@storybook/test';The following documents the API that existed before deprecation for reference purposes.
import { action, actions, configureActions } from "@storybook/addon-actions";CommonJS:
const { action, actions, configureActions } = require("@storybook/addon-actions");import { action, actions } from "@storybook/addon-actions";
// Create single action
const handleClick = action('button-click');
// Create multiple actions
const handlers = actions('onSubmit', 'onCancel', 'onFocus');
// Use in component
export const ButtonStory = {
args: {
onClick: handleClick,
onSubmit: handlers.onSubmit,
},
};The addon was built around several key components:
action() function for creating individual action handlersactions() function for creating multiple handlers at onceconfigureActions()Create individual action handlers for component events and callbacks.
function action(name: string, options?: ActionOptions): HandlerFunction;Create multiple action handlers from string names or configuration objects.
function actions<T extends string>(
...handlers: T[]
): ActionsMap<T>;
function actions<T extends string>(
handlerMap: Record<T, string>,
options?: ActionOptions
): ActionsMap<T>;Global configuration for action behavior and display options.
function configureActions(options?: ActionOptions): void;
interface ActionOptions extends Partial<TelejsonOptions> {
depth?: number;
clearOnStoryChange?: boolean;
limit?: number;
implicit?: boolean;
id?: string;
}type HandlerFunction = (...args: any[]) => void;
type ActionsMap<T extends string = string> = Record<T, HandlerFunction>;
type DecoratorFunction = (args: any[]) => any[];
interface ActionDisplay {
id: string;
data: {
name: string;
args: any[];
};
count: number;
options: ActionOptions;
}
interface ActionsParameters {
actions: {
argTypesRegex?: string;
disable?: boolean;
handles?: string[];
};
}/** Parameter key for actions configuration */
const PARAM_KEY = 'actions';
/** Addon identifier */
const ADDON_ID = 'storybook/actions';
/** Panel identifier for the actions panel */
const PANEL_ID = 'storybook/actions/panel';
/** Event identifier for action communication */
const EVENT_ID = 'storybook/actions/action-event';
/** Event identifier for clearing actions */
const CLEAR_ID = 'storybook/actions/action-clear';
/** Key used to mark cyclic object references */
const CYCLIC_KEY = '$___storybook.isCyclic';