How to change control values based on selected controls in Storybook?

18 views Asked by At

I have a story with a default component and a variant, when selecting the variant in storybook controls I want the value to update, for example:

export const Default: Story = {
    args: {
        type: 'header-title',
        label: 'Heading Title',
     }
}

export const HeaderText: Story = {
    args: {
        type: 'header-text',
        label: 'Heading Text',   
    }
}

When I select header-text the label should be 'Heading Text', and should be updated in the canvas of the storybook docs.

I can edit the textbox with the values, but I'd like this to happen automatically when I select the variant. how can I do this?

0

There are 0 answers