ScottEAdams

payload plugin phone field

by ScottEAdams
Custom fields
v1
^1.1.18

Overview

Summary generated from the README

Adds a phoneField helper that renders a phone number input in the Payload admin using react-phone-number-input. It accepts any TextField options plus any options of the underlying phone input component, such as limiting the selectable countries. Targets Payload 1.x.

Features

  • phoneField helper that returns a text field with a phone number input
  • Accepts standard TextField options like label and required
  • Passes options through to the phone input, such as a country list
  • Includes phoneIsValid and phoneIsPossible validation functions
  • Supports custom validation functions

Use cases

  • Collect contact phone numbers with country selection in a collection
  • Restrict phone entry to a set of countries and validate the numbers

From the author

Payload CMS plugin to add a phone number field

Installation

npm i payload-plugin-phone-field

12

Stars

0

Forks

0

Open Issues

4 years ago

Last Updated

18

Weekly Downloads

v1.0.6

npm Version

10.2 KB

Unpacked Size

1

Dependencies

GitHub stars

120 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202612
Dec 4, 202612
Dec 3, 202612
Dec 2, 202612
Dec 1, 202612
Nov 30, 202612
Nov 29, 202612
Nov 28, 202612
Nov 27, 202612
Nov 26, 202612
Nov 25, 202612
Nov 24, 202612
Nov 23, 202612
Nov 22, 202612
Nov 21, 202612
Nov 20, 202612
Nov 19, 202612
Nov 18, 202612
Nov 17, 202612
Nov 16, 202612
Nov 15, 202612
Nov 14, 202612
Nov 13, 202612
Nov 12, 202612
Nov 11, 202612
Nov 10, 202612
Nov 9, 202612
Nov 8, 202612
Nov 7, 202612
Nov 6, 202612
Nov 5, 202612
Nov 4, 202612
Nov 3, 202612
Nov 2, 202612
Nov 1, 202612
Oct 31, 202612
Oct 30, 202612
Oct 29, 202612
Oct 28, 202612
Oct 27, 202612
Oct 26, 202612
Oct 25, 202612
Oct 24, 202612
Oct 23, 202612
Oct 22, 202612
Oct 21, 202612
Oct 20, 202612
Oct 19, 202612
Oct 18, 202612
Oct 17, 202612
Oct 16, 202612
Oct 15, 202612
Oct 14, 202612
Oct 13, 202612
Oct 12, 202612
Oct 11, 202612
Oct 10, 202612
Oct 9, 202612
Oct 8, 202612
Oct 7, 202612
Oct 6, 202612
Oct 5, 202612
Oct 4, 202612
Oct 3, 202612
Oct 2, 202612
Oct 1, 202612
Sep 30, 202612
Sep 29, 202612
Sep 28, 202612
Sep 27, 202612
Sep 26, 202612
Sep 25, 202612
Sep 24, 202612
Sep 23, 202612
Sep 22, 202612
Sep 21, 202612
Sep 20, 202612
Sep 19, 202612
Sep 18, 202612
Sep 17, 202612
Sep 16, 202612
Sep 15, 202612
Sep 14, 202612
Sep 13, 202612
Sep 12, 202612
Sep 11, 202612
Sep 10, 202612
Sep 9, 202612
Sep 8, 202612
Sep 7, 202612
Sep 6, 202612
npm weekly downloads

18+6 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202618
Dec 4, 20264
Dec 3, 20266
Dec 2, 20265
Dec 1, 20269
Nov 30, 20268
Nov 29, 20267
Nov 28, 202614
Nov 27, 202614
Nov 26, 202613
Nov 25, 202613
Nov 24, 202611
Nov 23, 202611
Nov 22, 202619
Nov 21, 202612
Nov 20, 202616
Nov 19, 202624
Nov 18, 202625
Nov 17, 202623
Nov 16, 202624
Nov 15, 202619
Nov 14, 202619
Nov 13, 202617
Nov 12, 202616
Nov 11, 202615
Nov 10, 202616
Nov 9, 202615
Nov 8, 202613
Nov 7, 202620
Nov 6, 202617
Nov 5, 202610
Nov 4, 202610
Nov 3, 20269
Nov 2, 202612
Nov 1, 202612
Oct 31, 20267
Oct 30, 20267
Oct 29, 20266
Oct 28, 20266
Oct 27, 20266
Oct 26, 20264
Oct 25, 20263
Oct 24, 20263
Oct 23, 20263
Oct 22, 20266
Oct 21, 20266
Oct 20, 20267
Oct 19, 20266
Oct 18, 20266
Oct 17, 20265
Oct 16, 20265
Oct 15, 20264
Oct 14, 202612
Oct 13, 202611
Oct 12, 202611
Oct 11, 202620
Oct 10, 202619
Oct 9, 202619
Oct 8, 202618
Oct 7, 202610
Oct 6, 202610
Oct 5, 202610
Oct 4, 20265
Oct 3, 20269
Oct 2, 202611
Oct 1, 202611
Sep 30, 202611
Sep 29, 202618
Sep 28, 202618
Sep 27, 202615
Sep 26, 202614
Sep 25, 202615
Sep 24, 202617
Sep 23, 202617
Sep 22, 202617
Sep 21, 202617
Sep 20, 202617
Sep 19, 202614
Sep 18, 202611
Sep 17, 202611
Sep 16, 202612
Sep 15, 20266
Sep 14, 20268
Sep 13, 20268
Sep 12, 202614
Sep 11, 202614
Sep 10, 202612
Sep 9, 202613
Sep 8, 202612
Sep 7, 202613
Sep 6, 202612

Each point is npm's rolling 7-day download count.

Health Score

0/100Archived

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/559376777-root.svg)](https://payloaddirectory.dev/plugins/559376777-root)
HTML
<a href="https://payloaddirectory.dev/plugins/559376777-root"><img src="https://payloaddirectory.dev/badge/559376777-root.svg" alt="Payload Directory"></a>
Updated Nov 23, 2022Created Oct 29, 2022Published Nov 23, 2022

README

payload-plugin-phone-field

Uses react-phone-number-input to add phone number fields to PayloadCMS.

Installation

yarn add payload-plugin-phone-field

or

npm i payload-plugin-phone-field

Usage

Really straightforward implementation:

import { phoneField } from 'payload-plugin-phone-field'

fields: [
    phoneField(
        {
            name: 'phone', // required
        }
    )
]

But you can also add any options that TextField accepts and any options that PhoneNumberInput accepts.

For example, add a label, required and validation plus only show 6 countries to choose from:

fields: [
	phoneField(
		{
			name: 'phone', // required
			label: 'Contact Phone Number',
			required: true,
			validate: phoneIsValid
		},
		{ countries: ['DK', 'FI', 'NO', 'SE', 'GB', 'US'] }
	)
]

You can use your own validation function or one of the two included. You can read the rationale from Nikolay Kuchumov.

import { phoneIsValid, phoneIsPossible } from 'payload-plugin-phone-field'

Similar plugins