-
Notifications
You must be signed in to change notification settings - Fork 36
Addon adds actionHandler function to every function prop #63
Comments
You can add a new props to resolve this:
This will be fine but not perfect. |
Hi @QingLeiLi , thanks for the answer. That'd work but then I'd have to add a new prop just to make the component work with smart addons. I'm not saying that adding that prop is a good practice or not, but I think we shouldn't change the way we code our components in order to make them work with storybook. If this is not possible for now I'd like this to be seen as (positive) feedback for next versions. Thanks again! |
@javiergbas In 6.0.0 you can pass a list of props to ignore. In your case you can pass onEditClick there and action will not be automatically generated for it. |
I just hit this problem. Is there a way to set that per story, in the |
Oh... I think I was hitting a different issue. I was doing, in my template,
not realizing that Storybook was adding a All I had to do was reorder:
|
@tremby running into the same issue discovered the exact same thing that happened to you, I wish I have found you comment earlier 😆 |
If you use Storybook 6 or higher you can override the // in ComponentName.stories.tsx
export default {
component: ComponentName,
title: 'Components/ComponentName',
// override the default behavior of passing action-props for every prop that
// starts with 'on' (see the Storybook config 'preview.js')
parameters: { actions: { argTypesRegex: null } },
}; |
Hey, let's say I have the following component:
and my Box.stories.js
This works great, I can see the component but it always display the edit button even if I'm not passing anything in
onEditClick
prop.When inspecting it I can see that there is a n
actionHandler
function automatically passed (and can't see there when I stop usingstorybook-addon-smart-knobs
.I would like to have the possibility of showing every combination of props, including a version without the edit button. Is there anything that I can do? Is there any configuration/option that I'm missing?
Love the addon, thanks in advance!
The text was updated successfully, but these errors were encountered: