change args depending on select arg options in storybook

377 views Asked by At

How can I show object depending on select argTypes? I want show object data about selected options.

// dummy object

const dummyData = [
   { name : 'Primary'
     id   : 0  
   },
   { name : 'Secondary'
     id   : 1  
   },
]

argTypes: {
    colorType: {
      options: {'Primary' : 0, 'Secondary' : 1 },
      control: { type: 'radio' },
    },
    data: {
      table: dummyData[colorType] , // it's not real but I want show selected dummy Data
    },

I try useArgs add on in storybook docs, and Conditional Controls but I can't...

0

There are 0 answers