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

Provide unit option for range and numeric control types

Open JamesIves opened this issue 10 months ago • 0 comments

When using the range or number control, it applies a numeric value directly as the CSS variable, however in most cases this isn't going to be applicable in most CSS variables.

'section-spacing-sm': {
   control: 'range',
 },

Using the range sets: --section-spacing-sm: 5;. It would be fantastic if a unit value could be provided, for example:

'section-spacing-sm': {
   control: 'range',
   unit: 'px'
 },

This way when the CSS variable is set, it appropriately appends the unit type: --section-spacing-sm: 5px;

JamesIves avatar Apr 25 '24 15:04 JamesIves