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 FieldsBase64 image placeholder
Generates a base64-encoded placeholder image for Payload upload collections and stores it in a text field.
AI
Generates and stores vector embeddings for Payload fields using the OpenAI or NLP Cloud APIs.
AI Completions
Payload plugin that generates field content through OpenAI chat completions from the admin panel.
Google Maps Autocomplete Field
Integrates Google Maps Places Autocomplete into Payload CMS.
Better Fields
This plugin provides improved fields for the admin panel in Payload.
Character Count
Counts characters in richtext and text fields for Payload CMS.