Skip to content

[Feature Request]: Allow multiple conditional controls #21281

@megbailey

Description

@megbailey

Is your feature request related to a problem? Please describe

I'm converting dynamic knobs to controls in prep for 7.0 knob deprecation. Some of our more complex stories require more than one condition for some controls.

Adding more than one conditional in this way is not a valid solution.

{
    "control": {
        "type": "select"
    },
    "name": "Slides per view",
    "options": {
        "2": 2,
        "3": 3,
        "4": 4,
        "5": 5,
        "1 (default)": 1
    },
    if: { arg: 'type', eq: 'carousel'},
    if: { arg: 'carouseleffect', eq: 'slide'},
    ],
    "table": {
        "category": "Carousel"
    }
}

Describe the solution you'd like

I would like the ability to assign array of objects to 'if' rather than object. If conditions within the array should be logically ANDed.

Suggestion for solution

{
    "control": {
        "type": "select"
    },
    "name": "Slides per view",
    "options": {
        "2": 2,
        "3": 3,
        "4": 4,
        "5": 5,
        "1 (default)": 1
    },
    "if": [
        {
            "arg": "type",
            "eq": "carousel"
        },
        {
            "arg": "carouseleffect",
            "eq": "slide"
        }
    ],
    "table": {
        "category": "Carousel"
    }
}

Describe alternatives you've considered

I've considered splitting the situations into different stories, but this would alter the story experience.

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions