what-works-global

block settings

by what-works-global
payload-packages
Admin customization
v3
>=3.0.2 <4

Overview

Summary generated from the README

Adds a blockSettingsField helper that groups secondary fields of a block behind a Settings toggle in the block header. Settings can show inline in the block body or open in a drawer. Multiple settings fields on one block are merged into a single group during plugin initialization. Requires Payload 3 and registering the plugin in the config.

Features

  • blockSettingsField helper that wraps fields in a settings group
  • Toggle shows fields inline or in a drawer
  • Merges multiple settings fields on a block into one group
  • Canonical option picks the source of truth when merging
  • Replaces the block Label with a settings-aware label
  • Client components and hooks for custom block labels with extra actions

Use cases

  • Keep block editing forms tidy by hiding theme, anchor or variant options behind a Settings button
  • Build custom block row headers that include the settings toggle plus extra action buttons

From the author

Utilities for configuring and composing Payload block settings.

Installation

npm i @whatworks/payload-block-settings

16

Stars

1

Forks

2

Open Issues

3 days ago

Last Updated

163

Weekly Downloads

v2.0.2

npm Version

59.4 KB

Unpacked Size

0

Dependencies

Repository stars

16+1 since Sep 7

Show data
Repository stars by day (UTC)
DateStars
Dec 6, 202616
Dec 5, 202616
Dec 4, 202616
Dec 3, 202616
Dec 2, 202616
Dec 1, 202616
Nov 30, 202616
Nov 29, 202616
Nov 28, 202616
Nov 27, 202616
Nov 26, 202616
Nov 25, 202616
Nov 24, 202616
Nov 23, 202616
Nov 22, 202616
Nov 21, 202616
Nov 20, 202616
Nov 19, 202616
Nov 18, 202616
Nov 17, 202615
Nov 16, 202615
Nov 15, 202615
Nov 14, 202615
Nov 13, 202615
Nov 12, 202615
Nov 11, 202615
Nov 10, 202615
Nov 9, 202615
Nov 8, 202615
Nov 7, 202615
Nov 6, 202615
Nov 5, 202615
Nov 4, 202615
Nov 3, 202615
Nov 2, 202615
Nov 1, 202615
Oct 31, 202615
Oct 30, 202615
Oct 29, 202615
Oct 28, 202615
Oct 27, 202615
Oct 26, 202615
Oct 25, 202615
Oct 24, 202615
Oct 23, 202615
Oct 22, 202615
Oct 21, 202615
Oct 20, 202615
Oct 19, 202615
Oct 18, 202615
Oct 17, 202615
Oct 16, 202615
Oct 15, 202615
Oct 14, 202615
Oct 13, 202615
Oct 12, 202615
Oct 11, 202615
Oct 10, 202615
Oct 9, 202615
Oct 8, 202615
Oct 7, 202615
Oct 6, 202615
Oct 5, 202615
Oct 4, 202615
Oct 3, 202615
Oct 2, 202615
Oct 1, 202615
Sep 30, 202615
Sep 29, 202615
Sep 28, 202615
Sep 27, 202615
Sep 26, 202615
Sep 25, 202615
Sep 24, 202615
Sep 23, 202615
Sep 22, 202615
Sep 21, 202615
Sep 20, 202615
Sep 19, 202615
Sep 18, 202615
Sep 17, 202615
Sep 16, 202615
Sep 15, 202615
Sep 14, 202615
Sep 13, 202615
Sep 12, 202615
Sep 11, 202615
Sep 10, 202615
Sep 9, 202615
Sep 8, 202615
Sep 7, 202615

Shared by 12 plugins in what-works-global/payload-packages.

npm weekly downloads

210+196 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026210
Dec 5, 2026243
Dec 4, 2026290
Dec 3, 2026258
Dec 2, 2026263
Dec 1, 2026324
Nov 30, 2026343
Nov 29, 2026297
Nov 28, 2026263
Nov 27, 2026212
Nov 26, 2026214
Nov 25, 2026245
Nov 24, 2026227
Nov 23, 2026214
Nov 22, 2026251
Nov 21, 2026247
Nov 20, 2026327
Nov 19, 2026291
Nov 18, 2026356
Nov 17, 2026353
Nov 16, 2026366
Nov 15, 2026373
Nov 14, 2026419
Nov 13, 2026387
Nov 12, 2026388
Nov 11, 2026324
Nov 10, 2026336
Nov 9, 2026328
Nov 8, 2026286
Nov 7, 2026242
Nov 6, 2026220
Nov 5, 2026220
Nov 4, 2026196
Nov 3, 2026159
Nov 2, 2026149
Nov 1, 2026151
Oct 31, 2026142
Oct 30, 2026115
Oct 29, 202685
Oct 28, 202640
Oct 27, 202632
Oct 26, 202632
Oct 25, 202629
Oct 24, 202623
Oct 23, 202615
Oct 22, 202619
Oct 21, 202625
Oct 20, 202624
Oct 19, 202625
Oct 18, 202636
Oct 17, 202680
Oct 16, 2026109
Oct 15, 2026134
Oct 14, 2026137
Oct 13, 2026134
Oct 12, 2026134
Oct 11, 2026143
Oct 10, 2026105
Oct 9, 2026100
Oct 8, 202674
Oct 7, 202665
Oct 6, 202663
Oct 5, 202667
Oct 4, 202644
Oct 3, 202648
Oct 2, 202625
Oct 1, 202637
Sep 30, 202645
Sep 29, 202647
Sep 28, 202648
Sep 27, 202649
Sep 26, 202641
Sep 25, 202640
Sep 24, 202626
Sep 23, 202625
Sep 22, 202622
Sep 21, 202622
Sep 20, 202626
Sep 19, 202631
Sep 18, 202635
Sep 17, 202637
Sep 16, 202633
Sep 15, 202637
Sep 14, 202636
Sep 13, 202630
Sep 12, 202623
Sep 11, 202621
Sep 10, 202622
Sep 9, 202622
Sep 8, 202618
Sep 7, 202614

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

Health Score

58/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/1064440892-block-settings.svg)](https://payloaddirectory.dev/plugins/1064440892-block-settings)
HTML
<a href="https://payloaddirectory.dev/plugins/1064440892-block-settings"><img src="https://payloaddirectory.dev/badge/1064440892-block-settings.svg" alt="Payload Directory"></a>
Updated Dec 2, 2026Created Sep 26, 2025Published May 29, 2026

README

Payload Block Settings Plugin

Payload Block Settings Plugin

 

Hide extra fields for blocks behind a visibility toggle button.

Demo

Contents

Installation

pnpm add @whatworks/payload-block-settings

Usage

import { buildConfig } from 'payload'
import { blockSettingsField, blockSettingsPlugin } from '@whatworks/payload-block-settings'

export default buildConfig({
  collections: [
    {
      slug: 'pages',
      fields: [
        {
          name: 'components',
          type: 'blocks',
          blocks: [
            {
              slug: 'component',
              fields: [
                {
                  name: 'title',
                  type: 'text',
                },
                blockSettingsField({
                  fields: [
                    {
                      name: 'theme',
                      type: 'select',
                      options: ['light', 'dark'],
                    },
                    {
                      name: 'anchor',
                      type: 'text',
                    },
                  ],
                  settings: {
                    location: 'drawer',
                  },
                }),
                blockSettingsField({
                  fields: [
                    {
                      name: 'variant',
                      type: 'select',
                      options: ['default', 'featured'],
                    },
                  ],
                  settings: {
                    canonical: true,
                    location: 'inline',
                  },
                }),
              ],
            },
          ],
        },
      ],
    },
  ],
  plugins: [blockSettingsPlugin()],
})

Arguments

blockSettingsField() accepts normal Payload GroupField args. The only plugin-specific top-level addition is settings, which controls how that group participates in block settings behavior.

settings object

KeyTypeDefaultNotes
canonicalbooleanfalseMarks this settings group as the canonical source of truth when multiple blockSettingsField() calls exist on the same block. More than one canonical settings group throws an error.
location'inline' | 'drawer''inline'Controls whether the Settings button toggles the fields inline inside the block body or opens them in a drawer.

Using a custom Label

The plugin replaces block.admin.components.Label with BlockSettingsLabel on any block that uses blockSettingsField(). To customize, point the block's Label at your own component — include BlockSettingsToggleButton so the settings toggle still renders.

{
  slug: 'component',
  admin: {
    components: {
      Label: '/path/to/MyBlockLabel#MyBlockLabel',
    },
  },
  fields: [/* ... */],
}

Add actions alongside the default label

Use BlockLabelWithActions to keep Payload's default row header and append extra buttons next to the settings toggle.

'use client'

import {
  BlockLabelWithActions,
  BlockSettingsToggleButton,
  useBlockLabelState,
  type BlockLabelActionComponent,
} from '@whatworks/payload-block-settings/client'

const MyCustomActionButton: BlockLabelActionComponent = (props) => {
  const { path } = useBlockLabelState(props)
  return <button onClick={() => console.log('duplicate', path)}>⧉</button>
}

export const MyBlockLabel: BlockLabelActionComponent = (props) => (
  <BlockLabelWithActions {...props} actions={[BlockSettingsToggleButton, MyCustomActionButton]} />
)

Build a label from scratch

For full control over markup, skip BlockLabelWithActions and read row state directly from useBlockLabelState. Render BlockSettingsToggleButton anywhere inside.

'use client'

import {
  BlockSettingsToggleButton,
  useBlockLabelState,
  type BlockLabelActionComponent,
} from '@whatworks/payload-block-settings/client'

export const MyBlockLabel: BlockLabelActionComponent = (props) => {
  const { block, resolvedRowNumber, rowLabel } = useBlockLabelState(props)

  return (
    <div className="my-block-label">
      <span>#{resolvedRowNumber}</span>
      <strong>{rowLabel}</strong>
      <small>{block?.slug}</small>
      <BlockSettingsToggleButton {...props} />
    </div>
  )
}

Notes

  • Multiple blockSettingsField() calls on the same block are merged into one real settings group during plugin initialization. If two merged top-level settings fields have the same name, the plugin throws an error. When groups are merged, the first tagged settings field becomes the canonical stored group unless one field is declared with settings: { canonical: true }, in which case that field becomes the source of truth. If more than one tagged settings field is marked settings: { canonical: true }, the plugin throws an error.
  • The default settings field name is settings.
  • The merged settings group field is always moved to the first position in the block's fields array.

Similar plugins