From 07d41a165f0eed09bc162de3d0dda36b0646760c Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 21 Jan 2026 11:42:26 +0800 Subject: [PATCH] Show block content for label in List View --- packages/block-library/src/list-item/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/block-library/src/list-item/index.js b/packages/block-library/src/list-item/index.js index b40039e26cf1de..202f4bcb706f37 100644 --- a/packages/block-library/src/list-item/index.js +++ b/packages/block-library/src/list-item/index.js @@ -34,6 +34,18 @@ export const settings = { }, transforms, [ unlock( privateApis ).requiresWrapperOnCopy ]: true, + __experimentalLabel( attributes, { context } ) { + const { content } = attributes; + + const customName = attributes?.metadata?.name; + const hasContent = content?.trim().length > 0; + + // In the list view, use the block's content as the label. + // If the content is empty, fall back to the default label. + if ( context === 'list-view' && ( customName || hasContent ) ) { + return customName || content; + } + }, }; if ( window.__experimentalContentOnlyInspectorFields ) {