diff --git a/src/components/PropList.js b/src/components/PropList.js index 54cc17c0c..cb340b661 100644 --- a/src/components/PropList.js +++ b/src/components/PropList.js @@ -3,6 +3,7 @@ import cx from 'classnames'; import PropTypes from 'prop-types'; import FunctionDefinition from './FunctionDefinition'; import Markdown from 'react-markdown'; +import ReferenceExample from './ReferenceExample'; import styles from './PropList.module.scss'; import { format } from 'date-fns'; @@ -72,6 +73,7 @@ const PropList = ({ propTypes }) => { name, description, deprecation, + examples, isRequired, type, defaultValue, @@ -113,6 +115,9 @@ const PropList = ({ propTypes }) => { source={description} /> + {examples.map((example, idx) => ( + + ))} ); diff --git a/src/utils/propTypeInfo.js b/src/utils/propTypeInfo.js index 33e0adcf9..9303bd927 100644 --- a/src/utils/propTypeInfo.js +++ b/src/utils/propTypeInfo.js @@ -156,6 +156,7 @@ export const getPropTypeDefinition = (component, name, propType) => { description: propDocs?.text, deprecation: propDocs?.tags?.deprecated?.[0] ?? null, isRequired: propMeta?.some((item) => item.name === 'isRequired') ?? false, + examples: propDocs?.tags?.examples ?? [], type: { meta: getTypeMeta(name, propType, { component }), raw: getRawTypeName(propType),