Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-multi-email

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-multi-email

[![npm version](https://badge.fury.io/js/react-multi-email.svg)](https://badge.fury.io/js/react-multi-email) [![](https://img.shields.io/npm/dm/react-multi-email.svg)](https://www.npmjs.com/package/react-multi-email) [![](https://github.com/axisj/react-mu

  • 1.0.25
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

npm version

react-multi-email

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

  • Simple code
  • No dependency
  • Small size
  • Simple customization

See Demo

Installation

npm install react-multi-email

Usage

import * as React from 'react';
import { ReactMultiEmail, isEmail } from 'react-multi-email';
import 'react-multi-email/dist/style.css';

interface Props {}

function BasicExample(props: Props) {
  const [emails, setEmails] = React.useState<string[]>([]);
  const [focused, setFocused] = React.useState(false);

  return (
    <form>
      <h3>Email</h3>
      <ReactMultiEmail
        placeholder='Input your email'
        emails={emails}
        onChange={(_emails: string[]) => {
          setEmails(_emails);
        }}
        autoFocus={true}
        onFocus={() => setFocused(true)}
        onBlur={() => setFocused(false)}
        getLabel={(email, index, removeEmail) => {
          return (
            <div data-tag key={index}>
              <div data-tag-item>{email}</div>
              <span data-tag-handle onClick={() => removeEmail(index)}>
                ×
              </span>
            </div>
          );
        }}
      />
      <br />
      <h4>react-multi-email value</h4>
      <h3>Focused: {focused ? 'true' : 'false'}</h3>
      <p>{emails.join(', ') || 'empty'}</p>
    </form>
  );
}

export default BasicExample;

Props

PropertyTypeDefaultDescription
idstring
emailsstring[]
onChange(emails: string[]) => void;
enable({ emailCnt }: { emailCnt: number }) => boolean;
onDisabled() => void;
onChangeInput(value: string) => void;
onFocus() => void;
onBlur() => void;
onKeyDown(evt: React.KeyboardEvent) => void;
onKeyUp(evt: React.KeyboardEvent) => void;
noClassboolean
validateEmail(email: string) => boolean | Promise;
enableSpinnerboolean
styleReact.CSSProperties
getLabel ( email: string, index: number, removeEmail: (index: number, isDisabled?: boolean) => void, ) => React.ReactNode;
classNamestring''
inputClassNamestring''
placeholderstring | React.ReactNode;
autoFocusboolean;
spinner() => React.ReactNode;
delimiterstring;'[ ,;]'
autoCompletestring | undefined
initialInputValuestring | undefined''
disableOnBlurValidationboolean | undefinedfalse
inputValuestring | undefinedundefined

License

MIT

If you don't mind, don't forget to press "star" before leaving.

FAQs

Package last updated on 18 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc