axisj / react-multi-email

:octocat: A simple react component to format multiple email as the user types.

Home Page:https://react-multi-email.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add emails on format: John Johnson <john@john.com>

daggala opened this issue · comments

It's quite common in gmail and other mail clients that the emails are displayed with the names and then the email inside chevrons, like this: John Johnson john@john.com (see gmail screenshot below)

Capture d’écran 2021-05-05 à 4 59 53 PM

It would be great to be able to copy paste this kind of format in the textfield and keep the format when it transforms into a chip:

Capture d’écran 2021-05-05 à 5 18 49 PM

Pasteable example exactly how gmail supports it: Marsellus Wallace <marsellus@foo.com>, Winston Wolf <winston@foo.com>,.

Maybe this lib could parse the input to a list of objects? [{firstName: 'Marsellus', lastName: 'Wallace', email: 'marsellus@foo.com'}, ...].

How will this component know the user's name? You would need an external service for that.
I would think that you could take the component onChange event and create a lookup array with names. Then just create your own display component in getLabel to match up the email (as the key) to your name lookup.

I was thinking the same. But, where do you get the full names? I guess a DB you build up somewhere?