diff --git a/packages/block-editor/src/components/multi-selection-inspector/index.js b/packages/block-editor/src/components/multi-selection-inspector/index.js index 23d890d79fff4d..5b06facf11bf7b 100644 --- a/packages/block-editor/src/components/multi-selection-inspector/index.js +++ b/packages/block-editor/src/components/multi-selection-inspector/index.js @@ -12,6 +12,24 @@ import { __experimentalHStack as HStack } from '@wordpress/components'; import BlockIcon from '../block-icon'; import { store as blockEditorStore } from '../../store'; +/** + * MultiSelection Inspector component displays the number of selected blocks. + * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/multi-selection-inspector/README.md + * + * @example + * ```jsx + * import { } from '@wordpress/block-editor'; + * + * const SelectedBlockCount = getSelectedBlockCount(); + * + * if ( SelectedBlockCount > 1 ) { + * const MyMultiSelectionInspector = () => ; + *} + *``` + * + * @return {Element} MultiSelectionInspector + */ export default function MultiSelectionInspector() { const selectedBlockCount = useSelect( ( select ) => select( blockEditorStore ).getSelectedBlockCount(), diff --git a/packages/block-editor/src/components/multi-selection-inspector/stories/index.story.js b/packages/block-editor/src/components/multi-selection-inspector/stories/index.story.js new file mode 100644 index 00000000000000..a1158b4aa5dc6b --- /dev/null +++ b/packages/block-editor/src/components/multi-selection-inspector/stories/index.story.js @@ -0,0 +1,26 @@ +/** + * Internal dependencies + */ +import MultiSelectionInspector from '../'; + +const meta = { + title: 'Components/MultiSelectionInspector', + component: MultiSelectionInspector, + parameters: { + docs: { + description: { + component: + 'The `MultiSelectionInspector` component is used to display the inspector for multiple selected blocks. The number of blocks is updated based on the state of the selected blocks in the block editor', + }, + canvas: { sourceState: 'shown' }, + }, + }, +}; + +export default meta; + +export const Default = { + render: function Template( { ...args } ) { + return ; + }, +};