You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write the correct types in the Prop interface for that particular prop and destructure the props and use a default value there so that the storybook has the correct control types and the default value in the documentation table.
Prop types
type BadgeType = 'dimmed' | 'default' | 'white' | 'blue';
interface Props
extends React.ComponentPropsWithoutRef<typeof BadgeContainer> {
/** Sets the label of Badge. */
label: string | number;
/** Sets the variant of the Badge. */
variant?: BadgeType;
}
I can see Francis' point here. Not sure if React.FC is the right way to go. TBH at the moment I'm at a complete loss as to how to type a component or its props.
When you want to style the component according to the prop (different themes/variants will have different styles for the UI component):
Example:
Flow for adding a new prop to any UI component
Prop types
Destructuring Props in the component
The text was updated successfully, but these errors were encountered: