Need ideas to build a recipient list like Gmail in Vue3

I wanted to build a recipient list like in Gmail using Vue3 recently but I am out of idea on how to accomplish this and I can’t seem to find good ressources online.

recipient list

I have an array of string that contains the emails and I can loop over them to display them in a div. But how do I know when I reach the end of the div and that I have to remove the email?

Then, each hidden emails would be counted and shown as a badge. No badge is shown if all emails fit in the box of course.

Thank you for your guidance!

I did not try anything yet as I do not even know where to start with this.
Should I get the width of the container div, but then how do I know when a children div containing an email reaches the end of the parent?