I am building a design system library in React and TypeScript using Storybook. Most components support setting custom styles using the style prop. I am trying to reflect this in Storybook using the Controls feature.
Consider the following Button story with a variant and an attempt to add a style prop:
// Button.stories.js
import { Button } from './button';
export default {
component: Button,
title: 'Button',
argTypes: {
variant: {
control: {
type: 'radio',
options: ['primary', 'secondary']
}
},
style: {
control: {
type: 'text'
},
defaultValue: '{marginBottom: 10}'
}
}
};
What is the correct control type I should use when the type of the style props is React.CSSProperties?
What is the correct format for the defaultValue?
