Delete button with confirmation

For an application, I want to add a confirmation dialog to a delete button in order to prevent my users from “oups ! I lost data”.

I want something very basic using native web browser window.confirm.

I came across this post but I’d like to avoid ports and have a web component instead.

If there is no know implementation, I’ll probably do it myself but I want to avoid to duplicate work and rather contribute to existing one.

Possibly a better approach than a web component https://ellie-app.com/yKLggjjmLm8a1