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

[Feature Request] functions for conditional controls #19135

Open
c-vetter opened this issue Sep 7, 2022 · 1 comment
Open

[Feature Request] functions for conditional controls #19135

c-vetter opened this issue Sep 7, 2022 · 1 comment

Comments

@c-vetter
Copy link

c-vetter commented Sep 7, 2022

Is your feature request related to a problem? Please describe
In the course of my current client project, we stumbled across #19130 while trying to use the conditional controls feature to reproduce our TypeScript interfaces in the controls table.

We quickly found that the simple conditions will become cumbersome or even ineffectual in complex situations.

Describe the solution you'd like
Adding more operators will probably yield little value for most cases, so it would be nice to be able to provide a function that just receives the current controls data as input and returns a boolean.

That way, the current arg+operator would be a shorthand for the most common cases, but cases such as dependency on multiple other props would be doable in the context where the problem space is best known.

Describe alternatives you've considered
Not using the feature was our goto so far 🤷‍♂️ but we'd like to use it as much as possible.

Are you able to assist to bring the feature to reality?
I can probably code the whole thing, but I wouldn't know where to start and Storybook's source looks so hairy that I'd be afraid to break everything without some pointers.

@jawinn
Copy link

jawinn commented Apr 30, 2024

This would be a very useful addition, and would help with a lot of the other limitations that currently exist with conditional controls. Such as the inability to set multiple conditional controls or conditional controls that check against multiple values (related -- #21281).

Being able to define a function that returns a boolean would open this up to let developers handle more complex situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants