Displays a warning message, typically in the context of a particular block. It may present given actions to the user.
As seen in BlockInvalidWarning:
As seen in withMultipleValidation:
All of the following are optional.
-
children
: Intended to represent the block to which the warning pertains. See screenshots above. -
className
: Classes to pass to element. -
actions
: An array of elements to be rendered as action buttons in the warning element. -
secondaryActions
: An array of { title, onClick } to be rendered as options in a dropdown of secondary actions.
<Warning
actions={ [ <Button onClick={ fixIssue }>{ __( 'Fix issue' ) }</Button> ] }
secondaryActions={ [
{
title: __( 'Get help' ),
onClick: getHelp,
},
{
title: __( 'Remove block' ),
onClick: removeBlock,
},
] }
>
{ __( 'This block ran into an issue.' ) }
</Warning>