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
- 4
- Last publish
- Nov 23, 2022
More from ScottEAdams
View profileSimilar plugins
More in FieldsBetter Fields
This plugin provides improved fields for the admin panel in Payload.
Character Count
Counts characters in richtext and text fields for Payload CMS.
Color Picker Field
Add a color picker field to Payload collections with HEX support.
Icon Picker
Adds an icon picker field plugin for Payload CMS with search and SVG support.
Field Factories
Provides factory functions for creating Payload CMS field configurations.
Phone Number
Plugin for formatting and validating phone numbers in Payload CMS.