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
- 11
- Last publish
- Nov 23, 2022
More from ScottEAdams
View profileSimilar plugins
More in FieldsMenus
Adds a menus collection to Payload for building navigation with nested items, collection links, custom URLs, icons, and preview images.
Icon Picker
Adds an icon picker field plugin for Payload CMS with search and SVG support.
Barcodes
Adds Code 128, EAN-13 and QR code generation to Payload product collections with a printable label page and optional admin print buttons.
Shipping Classes
Adds weight, dimensions, and shipping class fields to Payload products and variants, storing values canonically in grams and millimetres for cart totalling.
Downloads
Sells digital products from a Payload store using signed, expiring download links that stop working when an order is refunded.
Order Numbers
Assigns every Payload ecommerce order a short, readable, concurrency-safe number like ORD-01042 via a reservations collection.