diff --git a/packages/block-editor/src/components/caption/README.md b/packages/block-editor/src/components/caption/README.md new file mode 100644 index 00000000000000..d1f8bcddaaceda --- /dev/null +++ b/packages/block-editor/src/components/caption/README.md @@ -0,0 +1,49 @@ +## Caption + +The `Caption` component renders the [caption part](https://wordpress.org/documentation/article/gallery-block/#caption) of some blocks (image, gallery...). + +This component encapsulates the "caption" behaviour and styles over a `` so it can be used in other components such as the `BlockCaption` component. + +## Table of contents + +1. [Development guidelines](#development-guidelines) +2. [Related components](#related-components) + +## Development guidelines + +### Usage + +Renders a Caption area: + +```jsx +import { Caption } from '@wordpress/block-editor'; +const BlockCaption = ( { + onBlur, + onChange, + onFocus, + isSelected, + shouldDisplay, + text, + insertBlocksAfter, +} ) => ( + + + +); +``` + +### Props + +The properties `isSelected`, `onBlur`, `onChange`, `onFocus`, `shouldDisplay`, `value`, `insertBlocksAfter` of this component are passed directly to their related props of its inner `` component ([see detailed info about the RichText component's props](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md)). + +## Related components + +Caption components is mostly used by the [`BlockCaption`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-caption) component. \ No newline at end of file