{"id":20333068,"url":"https://github.com/jaebradley/email-prop-type","last_synced_at":"2025-04-11T21:33:05.058Z","repository":{"id":57222849,"uuid":"112791955","full_name":"jaebradley/email-prop-type","owner":"jaebradley","description":"✉️ Email React Prop Type","archived":false,"fork":false,"pushed_at":"2020-08-14T18:59:21.000Z","size":4024,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T17:46:37.160Z","etag":null,"topics":["proptype-validators","proptypes","react"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/email-prop-type","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaebradley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-01T22:12:46.000Z","updated_at":"2021-04-19T08:39:22.000Z","dependencies_parsed_at":"2022-08-28T21:40:09.501Z","dependency_job_id":null,"html_url":"https://github.com/jaebradley/email-prop-type","commit_stats":null,"previous_names":["jaebradley/prop-types-email-validator"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Femail-prop-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Femail-prop-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Femail-prop-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Femail-prop-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaebradley","download_url":"https://codeload.github.com/jaebradley/email-prop-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247975769,"owners_count":21026936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proptype-validators","proptypes","react"],"created_at":"2024-11-14T20:29:13.547Z","updated_at":"2025-04-11T21:33:05.016Z","avatar_url":"https://github.com/jaebradley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Email Prop Type](https://github.com/jaebradley/email-prop-type/workflows/Email%20Prop%20Type/badge.svg)\n[![codecov](https://codecov.io/gh/jaebradley/email-prop-type/branch/master/graph/badge.svg)](https://codecov.io/gh/jaebradley/email-prop-type)\n[![npm](https://img.shields.io/npm/v/email-prop-type.svg)](https://www.npmjs.com/package/email-prop-type)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/email-prop-type)\n[![npm-total-downloads](https://img.shields.io/npm/dt/email-prop-type.svg)](https://www.npmjs.com/package/email-prop-type)\n![GitHub](https://img.shields.io/github/license/jaebradley/email-prop-type)\n\n# `email-prop-type`\n\n## Introduction\n\nThis package is used to validate if a React Prop value is a valid email address.\n\nCurrently, 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?\n\nAdditionally, 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.\n\nDepends on [the `email-validator` package](https://github.com/Sembiance/email-validator).\n\n## Installation\n\n```bash\nnpm install --save email-prop-type\n```\n\nAs 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`.\n\n## Example Usage\n\n```javascript\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport emailPropType from 'email-prop-type';\n\n// Create a basic Hyperlink Component with a mailto href value\nconst Hyperlink = props =\u003e (\n  \u003ca href={`${mailto:props.emailAddress}`\u003e{props.text}\u003c/a\u003e\n);\n\nHyperlink.propTypes = {\n  text: PropTypes.string.isRequired,\n  emailAddress: emailPropType.isRequired, // can also specify emailPropType if it is not required\n};\n```\n\n## Alternatives\n\nI didn't see many alternatives:\n\n* It doesn't look like [the `airbnb/prop-types` project](https://github.com/airbnb/prop-types) has email validation.\n* 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaebradley%2Femail-prop-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaebradley%2Femail-prop-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaebradley%2Femail-prop-type/lists"}