diff --git a/examples/cra-ts-kitchen-sink/src/stories/Button.tsx b/examples/cra-ts-kitchen-sink/src/stories/Button.tsx index 7f0292d659cd..80870f1e1f52 100644 --- a/examples/cra-ts-kitchen-sink/src/stories/Button.tsx +++ b/examples/cra-ts-kitchen-sink/src/stories/Button.tsx @@ -9,7 +9,12 @@ interface ButtonProps { /** * Is primary? */ - primary: boolean; + primary?: boolean; + + /** + * default is false + */ + secondary: boolean; } /** @@ -23,4 +28,5 @@ export const Button: FC = ({ children, onClick }) => ( Button.defaultProps = { primary: true, + secondary: false, }; diff --git a/lib/components/src/blocks/PropsTable/PropValue.tsx b/lib/components/src/blocks/PropsTable/PropValue.tsx index 1c7ac698c09a..f40d22996497 100644 --- a/lib/components/src/blocks/PropsTable/PropValue.tsx +++ b/lib/components/src/blocks/PropsTable/PropValue.tsx @@ -75,11 +75,12 @@ const PropSummary: FC = ({ value }) => { const { summary, detail } = value; const [isOpen, setIsOpen] = useState(false); - // summary is used for the default value // below check fixes not displaying default values for boolean typescript vars const summaryAsString = - summary && typeof summary.toString === 'function' ? summary.toString() : summary; + summary !== undefined && summary !== null && typeof summary.toString === 'function' + ? summary.toString() + : summary; if (isNil(detail)) { return ; }