I have discovered a way of creating a label and a help property for a component that doesn’t have it’s own label or help properties, by wrapping that component in a BaseControl component. Here is my working solution:
createElement(PanelRow, {},
createElement(BaseControl, {
label: __('N element alignment', 'my-textdomain'),
help: __('Set the alignment for n element in this block','my-textdomain')
},
createElement(ButtonGroup, {},
createElement(Button, {
icon: 'editor-alignleft',
value: 'left',
isPrimary: (attributes.nelementalign === 'left'),
isSecondary: (attributes.nelementalign !== 'left'),
onClick: changeNElementAlign,
title: __('N element align left', 'my-textdomain')
}),
createElement(Button, {
icon: 'editor-aligncenter',
value: 'center',
isPrimary: (attributes.nelementalign === 'center'),
isSecondary: (attributes.nelementalign !== 'center'),
onClick: changeNElementAlign,
title: __('N element align center', 'my-textdomain')
}),
createElement(Button, {
icon: 'editor-alignright',
value: 'right',
isPrimary: (attributes.nelementalign === 'right'),
isSecondary: (attributes.nelementalign !== 'right'),
onClick: changeNElementAlign,
title: __('N element align right', 'my-textdomain')
})
)
)
),