Customize Delete Button in List or Library

Hello Community,
I am trying to customize List or Library delete button, when I select some record and hit delete button I don't want to delete it from List instead of i want to flag Yes in list as i have Yes/No column.

I don't want to delete from the list, i just want to remove that particular record from list or library grid control. and rather than delete i have one column in list that will be yes if delete button press.

Is thare any way i can achieve this, or i have to create new button for it,

If i have to create new button how i can place it in list or library control and get all selected item and set flag in list while i click that button.

Please let me know best approach and practice for this,
Thanks in advance.

Hello @harshp924,

Yes, you can add a custom button to List or Library control that updates selected items using PnPjs library. You can find the example in Add custom buttons to toolbar article.