NouanceLabs

payload better fields plugin

by NouanceLabs
Custom fields
v3
^3.22.0
MIT

Overview

Summary generated from the README

A collection of ready-made field helpers that you import individually and spread into a collection's fields array. Each field takes overrides for the underlying Payload field plus its own config. Fields reuse Payload admin styles and CSS variables, and some require installing extra dependencies yourself.

Features

  • Slug field generated from one or more other fields
  • Combo field that concatenates other fields with a separator
  • Number and pattern fields with formatting via react-number-format
  • Range slider field with min, max, step, markers and preview
  • Colour picker and colour text fields supporting hex, rgb and hsl
  • Telephone, alert box and timezone-aware date fields

Use cases

  • Add formatted price or phone inputs to collections in the admin panel
  • Generate slugs and full-name values automatically from other fields
  • Let editors pick brand colours or show inline alert notices in forms

From the author

A Payload plugin that aims to provide improved fields for the admin panel

Installation

npm i @nouance/payload-better-fields-plugin

294

Stars

9

Forks

27

Open Issues

1 years ago

Last Updated

3.7k

Weekly Downloads

v2.0.2

npm Version

176.9 KB

Unpacked Size

0

Dependencies

GitHub stars

294+3 since Sep 6

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

3.2K−3.2K since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20263,167
Dec 4, 20263,304
Dec 3, 20263,252
Dec 2, 20262,923
Dec 1, 20263,004
Nov 30, 20263,062
Nov 29, 20263,505
Nov 28, 20263,774
Nov 27, 20263,648
Nov 26, 20263,576
Nov 25, 20263,582
Nov 24, 20263,441
Nov 23, 20263,365
Nov 22, 20263,181
Nov 21, 20263,178
Nov 20, 20262,912
Nov 19, 20263,124
Nov 18, 20264,161
Nov 17, 20264,357
Nov 16, 20264,596
Nov 15, 20265,514
Nov 14, 20266,580
Nov 13, 20267,803
Nov 12, 20268,220
Nov 11, 20267,381
Nov 10, 20267,244
Nov 9, 20267,017
Nov 8, 20266,270
Nov 7, 20265,424
Nov 6, 20264,600
Nov 5, 20264,444
Nov 4, 20264,488
Nov 3, 20264,421
Nov 2, 20264,466
Nov 1, 20264,668
Oct 31, 20264,553
Oct 30, 20264,477
Oct 29, 20263,512
Oct 28, 20262,589
Oct 27, 20262,604
Oct 26, 20262,681
Oct 25, 20262,490
Oct 24, 20262,851
Oct 23, 20262,052
Oct 22, 20263,123
Oct 21, 20263,797
Oct 20, 20263,796
Oct 19, 20263,672
Oct 18, 20263,749
Oct 17, 20263,411
Oct 16, 20264,026
Oct 15, 20263,892
Oct 14, 20264,163
Oct 13, 20264,211
Oct 12, 20264,201
Oct 11, 20264,102
Oct 10, 20263,990
Oct 9, 20264,199
Oct 8, 20263,906
Oct 7, 20263,756
Oct 6, 20263,770
Oct 5, 20263,870
Oct 4, 20263,774
Oct 3, 20263,663
Oct 2, 20263,419
Oct 1, 20263,429
Sep 30, 20263,424
Sep 29, 20263,498
Sep 28, 20263,381
Sep 27, 20263,513
Sep 26, 20264,570
Sep 25, 20265,654
Sep 24, 20266,965
Sep 23, 20266,989
Sep 22, 20266,982
Sep 21, 20267,091
Sep 20, 202613,004
Sep 19, 202614,621
Sep 18, 202614,077
Sep 17, 202613,168
Sep 16, 202613,039
Sep 15, 202613,978
Sep 14, 202614,410
Sep 13, 20268,588
Sep 12, 20266,284
Sep 11, 20266,252
Sep 10, 20266,081
Sep 9, 20266,294
Sep 8, 20265,520
Sep 7, 20265,701
Sep 6, 20266,353

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

Health Score

55/100Good

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/686312872-root.svg)](https://payloaddirectory.dev/plugins/686312872-root)
HTML
<a href="https://payloaddirectory.dev/plugins/686312872-root"><img src="https://payloaddirectory.dev/badge/686312872-root.svg" alt="Payload Directory"></a>
Updated Apr 12, 2025Created Sep 2, 2023Published Apr 12, 2025

README

Better fields plugin

This plugin aims to provide you with very specific and improved fields for the admin panel.
We've tried to keep styling as consistent as possible with the existing admin UI, however if there are any issues please report them!

Every field will come with its own usage instructions and structure. These are subject to change!

Sponsors

Oversight PFP

⚠️ Breaking changes 2.0 release ⚠️

All fields have been changed for how they are imported. You will also need to install dependencies directly yourself. This should streamline the bundle size a lot especially for unused fields.

Payload compatibility

PayloadBetter fields
1.x< 1.0
2.x> 1.0
3.x> 2.0

Installation

  pnpm add @nouance/payload-better-fields-plugin
  # OR
  npm i @nouance/payload-better-fields-plugin

Fields

Styling

We've tried to re-use the internal components of Payload as much as possible. Where we can't we will re-use the CSS variables used in the core theme to ensure as much compatibility with user customisations.

If you want to further customise the CSS of these components, every component comes with a unique class wrapper in the format of bf<field-name>Wrapper, eg bfPatternFieldWrapper, to help you target these inputs consistently.

Slug field

source

slugField

Usage

import { CollectionConfig } from 'payload/types'
import { SlugField } from '@nouance/payload-better-fields-plugin/Slug'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...SlugField(
      {
        name: 'slug',
        admin: {
          position: 'sidebar',
        },
      },
      {
        useFields: ['title', 'subtitle'],
      },
    ),
  ],
}

Options

The SlugField accepts the following parameters

  • fieldsToUse - string defaults to 'title'

  • overrides

    • slugOverrides - TextField required Textfield overrides

    • checkboxOverrides - CheckboxField | Checkbox field overrides

Here is a more full example:

...SlugField('title'),

Notes

index and unique are set to true by default

Combo field

source

comboField

Usage

import { CollectionConfig } from 'payload/types'
import { ComboField } from '@nouance/payload-better-fields-plugin/Combo'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'fullName',
  },
  fields: [
    {
      type: 'row',
      fields: [
        {
          name: 'firstName',
          type: 'text',
        },
        {
          name: 'lastName',
          type: 'text',
        },
      ],
    },
    ...ComboField(['firstName', 'lastName'], { name: 'fullName' }),
  ],
}

Options

The ComboField accepts the following parameters

  • overrides - TextField required for name attribute

  • fieldToUse - string[] required

  • options

    • separator - string defaults to ' '

    • initial - string The starting string value before all fields are concatenated

Removed options:

  • callback - (value: string) => string You can apply a callback to modify each field value if you want to preprocess them

Number field

source | react-number-format NumericFormat

numberField

Usage

import { CollectionConfig } from 'payload/types'
import { NumberField } from '@nouance/payload-better-fields-plugin/Number'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'fullName',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...NumberField(
      {
        name: 'price',
        required: true,
      },
      {
        prefix: '$ ',
        suffix: ' %',
        thousandSeparator: ',',
        decimalScale: 2,
        fixedDecimalScale: true,
      },
    ),
  ],
}

Options

The NumberField accepts the following parameters

  • overrides - NumberField required for name attribute

  • format - NumericFormatProps required, accepts props for NumericFormat

    • callback - you can override the internal callback on the value, the value will be a string so you need to handle the conversion to an int or float yourself via parseFloat
    // example
    callback: (value) => parseFloat(value) + 20,
    

Pattern field

source | react-number-format PatternFormat

patternField

Usage

import { CollectionConfig } from 'payload/types'
import { PatternField } from '@nouance/payload-better-fields-plugin/Pattern'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'fullName',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...PatternField(
      {
        name: 'telephone',
        type: 'text',
        required: false,
        admin: {
          placeholder: '% 20',
        },
      },
      {
        format: '+1 (###) #### ###',
        prefix: '% ',
        allowEmptyFormatting: true,
        mask: '_',
      },
    ),
  ],
}

Options

The PatternField accepts the following parameters

  • overrides - TextField required for name attribute

  • format - PatternFormatProps required, accepts props for PatternFormat

    • format required, input for the pattern to be applied

    • callback - you can override the internal callback on the value, the value will be a string so you need to handle the conversion to an int or float yourself via parseFloat

    // example
    callback: (value) => value + 'ID',
    

Notes

We recommend using a text field in Payload.

Range field

source

rangeField

Usage

import { CollectionConfig } from 'payload/types'
import { RangeField } from '@nouance/payload-better-fields-plugin/Range'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...RangeField(
      {
        name: 'groups',
      },
      { min: 5, max: 200, step: 5 },
    ),
  ],
}

export default Examples

Options

The RangeField accepts the following parameters

  • overrides - NumberField required for name attribute

  • config - required

    • min - number defaults to 1

    • max - number defaults to 100

    • step - number defaults to 1

    • showPreview - boolean defaults to false, shows a preview box of the underlying selected value, n/a for null

    • markers - NumberMarker[] array of markers to be visually set, accepts an optional label

      • { value: number, label?: string}[]

Colour Text field

source | validate-color

colourTextField

Usage

import { CollectionConfig } from 'payload/types'
import { ColourTextField } from '@nouance/payload-better-fields-plugin/ColourText'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...ColourTextField({
      name: 'colour',
    }),
  ],
}

export default Examples

Options

The ColourTextField accepts the following parameters

  • overrides - TextField required for name attribute

Telephone field

source | react-phone-number-input

telephoneField

Usage

import { CollectionConfig } from 'payload/types'
import { TelephoneField } from '@nouance/payload-better-fields-plugin/Telephone'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...TelephoneField({
      name: 'telephone',
      admin: {
        placeholder: '+1 2133 734 253',
      },
    }),
  ],
}

export default Examples

Options

The TelephoneField accepts the following parameters

  • overrides - TextField required for name attribute

  • config - Config optional, allows for overriding attributes in the phone field

    • international defaults to true | Forces international formatting

    • defaultCountry accepts a 2-letter country code eg. 'US' | If defaultCountry is specified then the phone number can be input both in "international" format and "national" format

    • country accepts a 2-letter country code eg. 'US' | If country is specified then the phone number can only be input in "national" (not "international") format

    • initialValueFormat If an initial value is passed, and initialValueFormat is "national", then the initial value is formatted in national format

    • withCountryCallingCode If country is specified and international property is true then the phone number can only be input in "international" format for that country

    • countryCallingCodeEditable

    • smartCaret When the user attempts to insert a digit somewhere in the middle of a phone number, the caret position is moved right before the next available digit skipping any punctuation in between

    • useNationalFormatForDefaultCountryValue When defaultCountry is defined and the initial value corresponds to defaultCountry, then the value will be formatted as a national phone number by default

    • countrySelectProps

      • unicodeFlags defaults to false | Set to true to render Unicode flag icons instead of SVG images

Alert Box field

source

alertBoxField

Usage

import { CollectionConfig } from 'payload/types'
import { AlertBoxField } from '@nouance/payload-better-fields-plugin/AlertBox'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...AlertBoxField(
      {
        name: 'alert',
      },
      {
        type: 'info',
        message: 'Please be aware that the title is required for the mobile app.',
      },
    ),
  ],
}

export default Examples

Options

The AlertBoxField accepts the following parameters

  • overrides - UIField required for name attribute

  • config - Config required

    • type - a selection of info | alert | error which come with different styles

    • message - required string

    • className - optional string to help you style individual alerts better

    • icon - optional, default is enabled

      • enable - boolean, turn off the icon

      • Element - React component to override the provided icon

If you want to make this field appear conditionally, you should use the field's admin conditional config as provided by Payload.

Colour Picker field

source

colourPickerField

Usage

import { CollectionConfig } from 'payload/types'
import { ColourPickerField } from '@nouance/payload-better-fields-plugin/ColourPicker'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...ColourPickerField(
      {
        name: 'backgroundColour',
        required: true,
      },
      {
        type: 'hslA',
      },
    ),
  ],
}

export default Examples

Options

The ColourPickerField accepts the following parameters

  • overrides - TextField required for name attribute

  • config - Config required

    • type - defaults to hex, a selection of hex | hexA | rgb | rgbA | hsl | hslA

    • expanded - optional boolean, controls if the selector is visible by default

    • showPreview - optional boolean

Date field

source

dateField

The goal of this field is to help with management of timezones.

Usage

import { CollectionConfig } from 'payload/types'
import { DateField } from '@nouance/payload-better-fields-plugin/Date'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...DateField({
      name: 'date',
      admin: {
        date: {
          pickerAppearance: 'dayAndTime',
        },
      },
    }),
  ],
}

export default Examples

Options

The DateField accepts the following parameters

  • overrides - DateField required for name attribute

  • timezone - Timezone optional

    • enabled - defaults to true

    • timezones - optional list of timezones to customise available options

    • overrides - SelectField required for name attribute

Contributing

For development purposes, there is a full working example of how this plugin might be used in the dev directory of this repo.

git clone [email protected]:NouanceLabs/payload-better-fields-plugin.git \
  cd payload-better-fields-plugin && pnpm \
  cd demo && pnpm \
  cp .env.example .env \
  vim .env \ # add your payload details
  pnpm dev

Contributors

Thanks to the following people for contributing code to this plugin

Idan Yekutiel, MarkAtOmniux, Kalon Robson

Similar plugins