storybook-addon-cssprops icon indicating copy to clipboard operation
storybook-addon-cssprops copied to clipboard

Allow empty values with option to mass reset

Open JamesIves opened this issue 10 months ago • 0 comments

This is a great addon! I was wondering what your thoughts are on supporting empty values? The use case i have is:

  • I am defining my CSS properties in a stylesheet elsewhere. I have multiple themes I need to support, so providing a default value to this addon isn't super viable.
  • I want to create a way to mess around with the existing variables to essentially create a theme by overriding whatever they have set currently.
  • If the value is removed, I'd like it to just reset back to whatever I have set in my stylesheet.
  • Ideally there would be a mechanism to mass-reset all the values back to the default, empty state.

Functionally this works right now (with the exception of the reset), however the UI gets a little funky when you do either one of the following, as I end up with a "Set string" button that does not function in the second item example, and a lingering value that has no effect in the first.

cssprops: {
    'surface-horizontal-spacing-xxs': {
      value: '',
      control: 'text',
    },
    'size-200': { 
      description: 'Optional description',
      control: 'text',
    },
},

JamesIves avatar Apr 25 '24 14:04 JamesIves