# email-prop-type

> React Email Prop Type

Latest version **3.0.1** (published 2020-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install email-prop-type
pnpm add email-prop-type
yarn add email-prop-type
bun add email-prop-type
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2020-02-05 |
| First published | 2017-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | jae.b.bradley@gmail.com |
| Maintainers | jaebradley |
| Keywords | react, email, email prop-type, email prop, email prop-types, email props |

## Links

- npm: https://www.npmjs.com/package/email-prop-type
- Repository: https://github.com/jaebradley/email-prop-type
- Homepage: https://github.com/jaebradley/email-prop-type#readme
- Issues: https://github.com/jaebradley/email-prop-type/issues
- npm.io page: https://npm.io/package/email-prop-type

## Dependencies (1)

- [email-validator](https://npm.io/package/email-validator.md) ^2.0.4

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2020-02-05
- 3.0.0 — 2018-06-25
- 2.0.0 — 2018-05-18
- 1.1.7 — 2018-05-17
- 1.1.6 — 2018-04-19
- 1.1.5 — 2018-03-20
- 1.1.4 — 2018-03-15
- 1.1.3 — 2017-12-19
- 1.1.2 — 2017-12-07
- 1.1.1 — 2017-12-02
- 1.1.0 — 2017-12-02
- 1.0.0 — 2017-12-02

## README

[![Greenkeeper badge](https://badges.greenkeeper.io/jaebradley/email-prop-type.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/jaebradley/email-prop-type.svg?branch=master)](https://travis-ci.org/jaebradley/email-prop-type)
[![codecov](https://codecov.io/gh/jaebradley/email-prop-type/branch/master/graph/badge.svg)](https://codecov.io/gh/jaebradley/email-prop-type)
[![npm](https://img.shields.io/npm/v/email-prop-type.svg)](https://www.npmjs.com/package/email-prop-type)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/email-prop-type)
[![npm-total-downloads](https://img.shields.io/npm/dt/email-prop-type.svg)](https://www.npmjs.com/package/email-prop-type)
![GitHub](https://img.shields.io/github/license/jaebradley/email-prop-type)

# `email-prop-type`

## Introduction

This package is used to validate if a React Prop value is a valid email address.

Currently, there is no email prop type defined by [the `prop-types` package](https://www.npmjs.com/package/prop-types). While using `PropType.string` works, why not be as specific as possible when validating your props?

Additionally, though [it's relatively straightforward to create a custom prop type validator](https://www.ian-thomas.net/custom-proptype-validation-with-react/), if you need to implement similar prop type checking in multiple packages, you might not want to repeat yourself.

Depends on [the `email-validator` package](https://github.com/Sembiance/email-validator).

## Installation

```bash
npm install --save email-prop-type
```

As mentioned above, `email-prop-type` depends on the `email-validator` package. You need to install this package as a peer dependency of `email-prop-type`.

## Example Usage

```javascript
import React from 'react';
import PropTypes from 'prop-types';
import emailPropType from 'email-prop-type';

// Create a basic Hyperlink Component with a mailto href value
const Hyperlink = props => (
  <a href={`${mailto:props.emailAddress}`>{props.text}</a>
);

Hyperlink.propTypes = {
  text: PropTypes.string.isRequired,
  emailAddress: emailPropType.isRequired, // can also specify emailPropType if it is not required
};
```

## Alternatives

I didn't see many alternatives:

* It doesn't look like [the `airbnb/prop-types` project](https://github.com/airbnb/prop-types) has email validation.
* There's also [the `react-validator-prop-types` library](https://www.npmjs.com/package/react-validator-prop-types) but if you just want email validation, it might be too heavyweight.

---
_Source: https://npm.io/package/email-prop-type · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
