Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation]: Essentials Actions references @storybook/action-addons both in the current documentation and in the advanced/legacy documentation #25727

Open
tgigsigniant opened this issue Jan 23, 2024 · 2 comments · May be fixed by #28925

Comments

@tgigsigniant
Copy link

Describe the problem

Essentials Actions documentation references @storybook/action-addons both in the current documentation and in the advanced/legacy documentation.

Should we stop using the action function exported from @storybook/action-addons? And, will the action function from @storybook/action-addons be deprecated in v8 of storybook like the advanced/legacy documentation seems to suggest?

Additional context

No response

@shilman
Copy link
Member

shilman commented Jan 27, 2024

@kasperpeulen can you comment on this one?

@kasperpeulen
Copy link
Contributor

kasperpeulen commented Jan 29, 2024

The action function is not deprecated, and won't be deprecated in 8.0, you can keep using it, if you just want to log an action to the action panel.

But we recommend in general to assign the fn function from @storybook/test in 8.0 to your args for events/actions, except if your use case doesn't allow for it, for some advanced reasons.

// Replace your-framework with the name of your framework
import type { Meta } from '@storybook/your-framework';
import { fn } from '@storybook/test';

import { Button } from './Button';

const meta = {
  component: Button,
  // 👇 Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked
  args: { onClick: fn() },
} satisfies Meta<typeof Button>;

export default meta;

@peschee peschee linked a pull request Aug 20, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants