alphanull

payload plugin info tooltip

by alphanull
Admin customization
v3
v4
^3.90.2 || ^4.0.0-0
MIT

Overview

Summary generated from the README

Adds an info icon beside field labels in the Payload admin that opens a tooltip with help text. Text comes from admin.custom.infoTooltip, or optionally from existing admin.description values converted automatically. Setup requires registering the plugin and regenerating the import map. Supports Payload 3.90.2 and later, including Payload 4 betas.

Features

  • Shows admin.custom.infoTooltip as an info icon next to the field label
  • Accepts a string, a locale object, or a function like admin.description
  • Optionally converts every admin.description into a tooltip, with per-field opt-out
  • Covers fields inside Lexical editors such as link fields, blocks and inline blocks
  • Optional icon on list-view column headings and keyboard and screen reader support
  • Exports LabelWithInfo and InfoTooltip components plus a labelComponent option for custom labels

Use cases

  • Reduce clutter in long admin forms by moving lengthy field descriptions into tooltips
  • Add translated help text to fields without showing it permanently under the input
  • Build custom field labels that keep the info icon alongside extra buttons

From the author

Shows Payload field descriptions and admin.custom.infoTooltip as an info icon tooltip.

Installation

npm i @alphanull/payload-plugin-info-tooltip

7

Stars

0

Forks

0

Open Issues

1 months ago

Last Updated

28

Weekly Downloads

v1.0.1

npm Version

57.3 KB

Unpacked Size

0

Dependencies

GitHub stars

7+7 since Oct 11

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

31−311 since Oct 20

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202631
Dec 4, 202630
Dec 3, 202656
Dec 2, 202654
Dec 1, 202650
Nov 30, 202650
Nov 29, 202655
Nov 28, 202654
Nov 27, 202655
Nov 26, 202628
Nov 25, 202637
Nov 24, 202641
Nov 23, 202643
Nov 22, 202655
Nov 21, 202673
Nov 20, 202674
Nov 19, 202669
Nov 18, 202662
Nov 17, 202664
Nov 16, 202669
Nov 15, 202656
Nov 14, 202642
Nov 13, 202649
Nov 12, 202651
Nov 11, 202652
Nov 10, 202651
Nov 9, 202646
Nov 8, 202658
Nov 7, 202653
Nov 6, 202652
Nov 5, 202651
Nov 4, 202646
Nov 3, 202650
Nov 2, 202675
Nov 1, 202665
Oct 31, 202671
Oct 30, 202673
Oct 29, 202668
Oct 28, 202667
Oct 27, 202681
Oct 26, 2026395
Oct 25, 2026388
Oct 24, 2026381
Oct 23, 2026365
Oct 22, 2026365
Oct 21, 2026365
Oct 20, 2026342

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

Health Score

66/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/1423295618-root.svg)](https://payloaddirectory.dev/plugins/1423295618-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1423295618-root"><img src="https://payloaddirectory.dev/badge/1423295618-root.svg" alt="Payload Directory"></a>
Updated Oct 17, 2026Created Oct 17, 2026Published Oct 17, 2026

README

License Version

Payload Info Tooltip Plugin

Payload CMS plugin that shows field help as an info icon tooltip next to the label, instead of a description under the field.

Long field descriptions push the admin form apart, and may add unnecessary clutter for information rarely accessed. This plugin adds support to add additional information like help text into a small info icon next to the field label, as well as the ability to automatically convert existing field descriptions into tooltips.

Features

  • Shows admin.custom.infoTooltip as an info icon next to the field label.
  • Accepts the same values as admin.description: a string, a locale object, or a function ({ t, i18n }) => string.
  • Optionally turns every admin.description into a tooltip (useDescriptions: true), with a per-field opt-out.
  • Covers fields inside Lexical (link fields, blocks, inline blocks, nested editors), with no change to your lexicalEditor calls.
  • Optional icon on list-view column headings.
  • Works with keyboard and screen readers, with an option to drop the extra tab stop.
  • LabelWithInfo and InfoTooltip for labels you write yourself, and a labelComponent option to swap labels by rule.
  • Themeable through CSS variables, using Payload 4 tokens with Payload 3 fallbacks.
  • Tested with Payload 3.90.2, 3.91.0, 4.0.0-beta.0, and 4.0.0-beta.2.

Screenshots

Without PluginPlugin enabled
Standard field descriptions without PluginPlugin enabled, with descriptions converted to tooltips

Installation

pnpm add @alphanull/payload-plugin-info-tooltip

Configuration

import { buildConfig } from 'payload'
import { infoTooltipPlugin } from '@alphanull/payload-plugin-info-tooltip'

export default buildConfig({
  plugins: [
    infoTooltipPlugin({
      // options with defaults:
      useDescriptions: false,
      showInListView: false,
      focusable: true,
    }),
  ],
})

All options are optional. infoTooltipPlugin() without options changes nothing until a field sets admin.custom.infoTooltip. The plugin runs after all other plugins, wherever it is listed, so it also covers the fields they add.

OptionTypeDefaultDescription
useDescriptionsbooleanfalseMove every admin.description into the tooltip. See Converting descriptions.
showInListViewbooleanfalseAlso show the icon on list-view column headings.
focusablebooleantruePut every icon in the tab order, your own labels included. false drops that tab stop.

After adding the plugin, regenerate the import map so the admin can load the plugin's components:

pnpm payload generate:importmap

A running dev server does this by itself when the config changes, unless admin.importMap.autoGenerate is false. Commit the updated importMap.js: next build does not generate it.

Usage

Adding a tooltip to a field

Set admin.custom.infoTooltip on any field:

import type { CollectionConfig } from 'payload'

export const Pages: CollectionConfig = {
  slug: 'pages',
  fields: [
    {
      name: 'slug',
      type: 'text',
      admin: {
        custom: {
          infoTooltip: 'Used in the page URL.',
        },
      },
    },
  ],
}

The value takes the same forms as admin.description:

// String
infoTooltip: 'Used in the page URL.',

// Locale object
infoTooltip: {
  en: 'Used in the page URL.',
  de: 'Wird in der Seiten-URL verwendet.',
},

// Function
infoTooltip: ({ t }) => t('custom:slugInfo'),

The text is resolved on the server, per request, in the admin UI language (active language, then fallback, then the first key). It is not the content locale from the locale switcher. Functions never reach the browser.

A tooltip and a visible description can be combined:

{
  name: 'slug',
  type: 'text',
  admin: {
    description: 'Lowercase only.', // stays under the field
    custom: {
      infoTooltip: 'Used in the page URL.', // goes into the icon
    },
  },
}

Converting descriptions

With useDescriptions: true, every string, locale object, or function admin.description becomes the tooltip and is hidden under the field. It stays in admin.description, so generate:types still writes it into the JSDoc. Fields that set infoTooltip or have their own label keep their description visible.

fields: [
  {
    name: 'title',
    type: 'text',
    admin: {
      description: ({ t }) => t('custom:titleInfo'), // becomes the tooltip
    },
  },
  {
    name: 'notes',
    type: 'textarea',
    admin: {
      description: 'Long text…',
      custom: {
        infoTooltip: false, // opt out: the description stays visible
      },
    },
  },
]

infoTooltip: false has no effect while useDescriptions is off. Custom description components (admin.components.Description) are not converted. Neither are tab descriptions: Payload renders a tab's title as plain text, with no label slot for the icon.

Custom Labels

Payload lets a field replace its label with admin.components.Label, for example to place a button next to it. The plugin leaves such fields alone, so they show no icon by themselves. The components below bring the icon into labels you write yourself. Import them from @alphanull/payload-plugin-info-tooltip/client; their styles load with them.

Your own field label

Render LabelWithInfo inside your label. It renders Payload's FieldLabel, then the icon, then your children. The tooltip text comes from the field's infoTooltip.

{
  name: 'prompt',
  type: 'textarea',
  admin: {
    components: {
      Label: '/components/PromptLabel#PromptLabel',
    },
    custom: {
      infoTooltip: 'Describe the image you want.', // string or locale object
    },
  },
}
'use client'
import { LabelWithInfo, type LabelWithInfoProps } from '@alphanull/payload-plugin-info-tooltip/client'

export function PromptLabel(props: LabelWithInfoProps) {
  return (
    <LabelWithInfo field={props.field} path={props.path} schemaPath={props.schemaPath}>
      <button type="button">Generate</button>
    </LabelWithInfo>
  )
}

Here infoTooltip must be a string or a locale object. Payload would send a function to the browser with the field, so the plugin throws at startup instead. For translated text from a function, use labelComponent.

The labelComponent option

Use it when many fields need the same custom label, for example a button next to every rich-text field. labelComponent is a function passed to infoTooltipPlugin(). The plugin calls it for each field it walks, including fields inside Lexical, and renders the returned component in place of its default label. Return undefined to keep the default.

Compared with setting admin.components.Label on each field:

  • One rule instead of many fields. It also reaches fields you would otherwise have to find and change one by one, such as fields inside Lexical blocks.
  • Conditions live in one place. For example, return the component only while a feature is enabled.
  • The plugin still handles the field. With useDescriptions: true, descriptions are still converted. Your component receives the tooltip text resolved on the server as info, so function texts work too.

The component is also used for fields without tooltip text. Fields with their own admin.components.Label are skipped. The plugin registers the component for import-map generation.

infoTooltipPlugin({
  labelComponent: field =>
    field.type === 'richText'
      ? { path: '/components/RichTextLabel', exportName: 'RichTextLabel' }
      : undefined,
})
'use client'
import { LabelWithInfo, type LabelWithInfoProps } from '@alphanull/payload-plugin-info-tooltip/client'

export function RichTextLabel({ readOnly, ...props }: LabelWithInfoProps & { readOnly?: boolean }) {
  return (
    <LabelWithInfo {...props}>
      {!readOnly && <button type="button">Generate</button>}
    </LabelWithInfo>
  )
}

Props: field, info, path, schemaPath, readOnly, and showInListView.

Outside fields

LabelWithInfo also works with explicit props. InfoTooltip renders the icon alone, for text that is not a Payload label:

<LabelWithInfo htmlFor="prompt" info={hint} label="Prompt" required />

<legend>
  Length
  <InfoTooltip text={hint} />
</legend>

info, label, and text accept a string or a locale object. className is applied on the root element. focusable overrides the plugin option for one icon.

How It Works

Fields. When Payload builds the config, the plugin walks collections, globals, and block configs, including tabs, groups, arrays, and blocks. It runs after all other plugins, through Payload's plugin order. A field with tooltip text, or with a labelComponent, gets the plugin's server label. The text, a function included, is a server prop of that label. Payload keeps admin.components on the server, so the function never reaches the browser. The label resolves the text per request and renders LabelWithInfo or your component. A moved description gets an empty Description component that hides it in the form. The components are registered in admin.dependencies, which generate:importmap reads.

Lexical. Fields inside Lexical (link fields, blocks, inline blocks, nested editors) exist only once Payload has built the editor. The plugin wraps the root editor and each field-level editor and walks their feature props each time Payload builds them. Your lexicalEditor calls stay as they are. This walk uses Lexical internals; it is tested on 3.90.2 and 4.0.0-beta.0.

Tooltip. Hovering with a mouse opens the tooltip. A tap, Enter, or Space toggles it. The pointer can move onto the popup, for example to select its text. Escape, a click outside, focus moving elsewhere, or the pointer leaving icon and popup closes it. Screen readers read the text as the icon's description, without opening it. The focusable option is stored in admin.custom.infoTooltip, which Payload sends to the browser, so every icon reads it. The popup opens above the icon and flips below only when the space above is too small and the space below is larger. It stays inside the viewport, and the caret points at the icon in both positions.

Styling

Plugin variables, with Payload 4 tokens falling back to Payload 3:

  • --info-tooltip-bg — var(--color-bg-elevated, var(--theme-input-bg))
  • --info-tooltip-fg — var(--color-text, var(--theme-text))
  • --info-tooltip-icon-size — var(--text-body-medium-font-size, 1rem)
  • --info-tooltip-caret-x — set while open, so the caret stays on the icon

Public class hooks: info-tooltip-label, info-tooltip, info-tooltip__trigger, info-tooltip__popup, info-tooltip__content.

Limitations

  • Running last relies on Payload's plugin order, which Payload marks as experimental.
  • Field components that render their label and description themselves, instead of Payload's Label and Description slots, show no icon and keep the description visible. In Payload 4, the experimental slug field does this.

Development

pnpm lint   # ESLint + Stylelint
pnpm test   # Vitest
pnpm build  # lint and test first, then bundle and emit types

exports point at src in a workspace. pnpm publish replaces them with publishConfig.exports, which point at dist. npm publish does not, so publish with pnpm.

License

MIT License

Copyright © 2026–present Frank Kudermann @ alphanull.de

Similar plugins