A simple easy to use vanilla JavaScript library for creating input fields that accept multiple email addresses

Overview

MIT License LinkedIn


MeiMei - Multiple Email Input

MeiMei: A simple easy to use vanilla JavaScript library for creating input fields that accept multiple email addresses.
View Demo · Report Bug

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Example
  5. Todo
  6. License
  7. Contact
  8. Acknowledgements

About The Project

There are lots of component libraries with email inputs, yet very few that focus on multi email input and vanilla js. This library adds multi email input functionality possible in your web application.

This library is the result of a code challenge. It does not include full unit-test coverage or performance optimization. Just examples of unit-tests as a confrontation piece.

Built With

This project is primarily build with

For rest: see package.json

Getting Started

To get a local copy up and running follow these simple example steps.

Installation

  1. Clone the repo
    git clone https://github.com/lhstraathof/multiple-emails-input.git
  2. Duplicate meimei-lib.min.js from ./dist/
  3. Import meimei-lib-min.js before the closing tag and start using it
    <div class="input-target"></div>
    <script src="./meimei-lib.min.js"></script>
    <script>
     var inputContainerNode = document.querySelectorAll('.input-target');
     var emailsInput1 = MeiMei(inputContainerNode);
    </script>

Options

Name Type Description Default
placeholder string The placeholder tekst for the input field add more people…
onAddEntry function Triggers after adding an entry
onRemoveEntry function Triggers after removing an entry
theme object You can overwrite the default classes with your own theme

You can add options as a second parameter to MeiMei:

   <div class="input-target"></div>
   <script src="./meimei-lib.min.js"></script>
   <script>
    var customProps = {
        placeholder: 'Hi, add emails here',
    };
    var inputContainerNode = document.querySelectorAll('.input-target');
    var emailsInput1 = MeiMei(inputContainerNode, customProps);
   </script>

A custom theme with your own classes can be added, for example:

    var theme = {
        box: "custom-box-class",
        input: "custom-input-class",
        chip: "custom-chip-class",
        chipInvalid: "custom-chipInvalid-class",
        cross: "custom-cross-icon-class"
    };
    var customProps = { theme: theme };
    var inputContainerNode = document.querySelectorAll('.input-target');
    var emailsInput1 = MeiMei(inputContainerNode, customProps);

API

After adding MeiMei to your page and assigning it to a variable, you get access to the API and its follow methods:

Name Type Description
addEntry function Manually add an entry. This function accepts a string to add as entry to MeiMei
entryList array Array of entries active in the MeiMei element
inputFieldRef element Reference to the input field of MeiMei
optionalProps object The optional props you may have provided
ref element The box element of MeiMei
removeEntry function Manually remove an entry. This function accepts a ref from to the entryList (see API) and removes it from MeiMei

Usage

In the project directory, you can run:

npm run start

Runs the app in the development mode.
Open http://localhost:8080 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm run test

Launches the test runner (jest).

npm run build

Builds the app for production to the dist folder. It correctly bundles Typescript in production mode and optimizes the build.

Example

To see the live demo, go to https://lhstraathof.github.io/multiple-emails-input/

TODO

As this library is the result of a code challenge, there is still lots to be done:

  • Proper cross browser testing (mobile)
  • Make library available via NPM
  • Update webpack config to export to UMD, es-module, etc.
  • Deploy to CDN
  • Add unit-tests additional
  • Optimize performance
  • Add life-cycle methods and extend API (i.e. destroy MeiMei on target)
  • Add more theme's
  • Optimize sanitization
  • Optimize security
  • Highlight entry when user presses backspace on empty input before deleting prev. entry

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Lars Straathof - Lars.Amsterdam - [email protected]

Project Link: https://github.com/lhstraathof/multiple-emails-input

Acknowledgements

You might also like...

The friendly way to accept tips in ETH.

💸 cryptip.me The friendly way to accept tips in ETH. It's free, and no setup required. cryptip.me/your-ens-or-wallet-address Getting Started Project

Sep 23, 2022

📃 A public dataset of crypto addresses labeled

📃 A public dataset of crypto addresses labeled

EVM Labels A public dataset of crypto addresses labeled (Ethereum and more) Ethereum Label CSV JSON Updated exchange (Centralized Exchanges) View CSV

Jan 7, 2023

A beginner friendly hacktoberfest2022 repo made lately to accept valid open source contribution.

A beginner friendly hacktoberfest2022 repo made lately to accept valid open source contribution.

Hacktoberfest2022 A hacktoberfest2022 repo made lately to accept valid open source contribution. What is Hacktoberfest? Hacktoberfest is digitalocean’

Oct 20, 2022

A robust form library for Lit that enriches input components with easy-to-use data validation features.

A robust form library for Lit that enriches input components with easy-to-use data validation features.

EliteForms A robust form library for Lit that enriches input components with easy-to-use data validation features. Installation npm install elite-form

Jun 28, 2022

A Bootstrap plugin to create input spinner elements for number input

A Bootstrap plugin to create input spinner elements for number input

bootstrap-input-spinner A Bootstrap / jQuery plugin to create input spinner elements for number input. Demo page with examples Examples with floating-

Nov 7, 2022

A phone input component that uses intl-tel-input for Laravel Filament

A phone input component that uses intl-tel-input for Laravel Filament

Filament Phone Input This package provides a phone input component for Laravel Filament. It uses International Telephone Input to provide a dropdown o

Nov 29, 2022

jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask library

jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask  library

jquery-input-mask-phone-number A jQuery Plugin to make masks on input field to US phone format. Quick start 1. Add latest jQuery and jquery-input-mask

Aug 25, 2022

An easy-to-use jQuery plugin that allows the user to pick an icon from a responsive icon browser and shows the corresponding icon class in an input element.

Font Awesome Browser An easy-to-use jQuery plugin that allows the user to pick an icon from a responsive icon browser and shows the corresponding icon

May 1, 2021

Lightweight and easy to use vanilla js library to add css animations to elements on scroll.

Scrollrisen Trigger css animations on scroll as elements enter the viewport. Zero dependencies, lightweight and easy to use and customize Installation

Oct 13, 2022
Owner
Lars Straathof
Lars Straathof
Reduce misspelled email addresses in your web apps.

mailcheck.js The Javascript library and jQuery plugin that suggests a right domain when your users misspell it in an email address. mailcheck.js is pa

mailcheck 7.9k Dec 28, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Email Genie Allows autocomplete on email field by providing a list of domain suggestions (gmail.com, outlook.com, etc.).

Allows users to easily and quickly complete an email field by providing a list of domain suggestions (gmail.com, outlook.com, etc.). This package stands out for its flexibility, its compatibility with libraries / frameworks, but especially its use of basic HTML and Javascript functionalities that maximize the native behavior of desktop AND mobile browsers.

Simon Arnold 3 Oct 4, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Create beautiful, functional and extensive (Multi) Select Fields with pure, vanilla JavaScript.

tail.select.js - Beautify Select Fields (formerly tail.select) Replace and Improve your HTML <select> fields with style and without jQuery! The tail.s

Ciprian Popescu 69 Dec 30, 2022
Eth-explorers-extension - Chrome extension to open Ethereum addresses & transaction hash from any page on popular explorers + dashboards

eth-explorers-extension(s) This repository contains two folders with two extensions that work for address and transactions respectively. 1. eth-addres

Apoorv Lathey 71 Jan 6, 2023
💶 The package allows you accept payment using Lazerpay in your react native mobile app ⚡️

Lazerpay Official react-native sdk Lazerpay SDK allows you accept payments easily in your react-native application Installation npm install lazerpay-r

LazerPay 28 Dec 24, 2022
Lazerpay SDK allows you accept payments easily in your react application

Lazerpay Official react sdk Lazerpay SDK allows you accept payments easily in your react application Installation npm install lazerpay-react Usage imp

LazerPay 18 Nov 20, 2022
Script to fetch all NFT owners using moralis API. This script output is a data.txt file containing all owner addresses of a given NFT and their balances.

?? Moralis NFT Snapshot Moralis NFT API will only return 500 itens at a time when its is called. For that reason, a simple logic is needed to fetch al

Phill Menezes 6 Jun 23, 2022