Customizing document deletion modal

default discord avatar
3 months ago

I have a use case where I would like to display a custom message to the user when they choose to delete something.

One example use case is as follows --

I have a collection of blogs and collection of tags. The blogs each have a tags field with a hasMany relation to the tags. I add a tag called


and assign it to blogs A, B, and C.

When the user deletes the tag using the CMS, I have a hook that searches through all blogs and deletes the tag from the tags field as well.

However, I would like to modify the "Confirm deletion" modal copy to inform the user of which blogs will be affected, or at least how many. E.g., being able to display "This will remove the tag from blogs A, B, and C" or "This will affect 37 blog posts" would be great.

Is this currently possible in Payload, and if so, how? A general direction rather than an exact solution would be fine, e.g. there is a config option, or I would need to overwrite the modal with a custom component, etc.

Thanks in advance.

  • discord user avatar
    Payload Team
    2 months ago

    Hey @anodyne_one there isn't a config for this type of behavior, so you would need to build a custom component to handle this type of thing. Never hurts to ask though, and this sounds pretty handy!

    Let us know if you need anything else. Thanks!

  • default discord avatar
    2 months ago


Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.