Phone Field
Adds a phone number field to Payload collections with country-code selection and validation, powered by react-phone-number-input.
Installation
pnpm add payload-plugin-phone-field About
The plugin ships a `phoneField()` factory you drop into any collection's `fields` array. It returns a Payload `TextField` whose admin UI is replaced with `react-phone-number-input`, so editors get a country picker and a formatted national-number input instead of a plain text box. Two validation helpers are exported: `phoneIsValid` and `phoneIsPossible`. The first checks that a number matches a real assigned range for its country; the second is a looser check that only verifies the length is plausible. You pass either as the field's `validate` option, or supply your own. The factory accepts all standard `TextField` options (name, label, required, validate, admin config) as its first argument, plus any `react-phone-number-input` `FeatureProps` as the second. That second argument is where you constrain the country list, set a default country, or tweak formatting. It targets Payload 1.x (peer dep `payload ^1.1.18`) and is written in TypeScript. Stored values are E.164 strings, which work well for downstream SMS or call integrations.
Package info
- Package name
payload-plugin-phone-field- Latest version
1.0.6- Unpacked size
- 10 kB
- License
- MIT
- Weekly downloads
- 14
- Last publish
- Nov 23, 2022
More from ScottEAdams
View profileSimilar plugins
More in FieldsSimple RBAC
Enables role-based access control in Payload CMS.
Magic Login
A Magic Login plugin for Payload CMS that simplifies user authentication.
RBAC
Adds role-based access control to your Payload CMS.
reCAPTCHA v3
This plugin protects Payload collection operations using Google reCAPTCHA v3.
OIDC plugin
Integrate OpenID Connect authentication into Payload CMS.
Gatekeeper
Adds role-based access control to Payload CMS v3 with wildcard permissions, auto-generated permissions per collection, and a managed Roles collection.