denisprado

payload plugin image relationship

by denisprado
Custom fields
v3
^3.56.0

Overview

Summary generated from the README

Replaces the standard relationship field UI with a visual gallery that shows image thumbnails for selection. It is added to the plugins array with the slug or slugs of your media collection, and applies to relationship or upload fields pointing at those collections. Targets Payload 3.56 and later.

Features

  • Thumbnail gallery interface for choosing images
  • Paginated Load More for large media libraries
  • Backend search by alt text or filename
  • Supports single and multiple selection with hasMany
  • Selected images sorted first with a preview
  • Collapsible interface to save screen space

Use cases

  • Pick featured images for posts from a large media library visually
  • Select several gallery images on a document with a multi-select field

From the author

A Payload CMS plugin that enhances the relationship field to support image uploads.

Installation

npm i payload-plugin-image-relationship

3

Stars

0

Forks

1

Open Issues

1 years ago

Last Updated

90

Weekly Downloads

v1.1.9

npm Version

657.1 KB

Unpacked Size

0

Dependencies

GitHub stars

30 since Sep 6

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

4−2 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20264
Dec 4, 20264
Dec 3, 20263
Dec 2, 20262
Dec 1, 20263
Nov 30, 20263
Nov 29, 202631
Nov 28, 202631
Nov 27, 202631
Nov 26, 202631
Nov 25, 202631
Nov 24, 202630
Nov 23, 202630
Nov 22, 20263
Nov 21, 20264
Nov 20, 20264
Nov 19, 20266
Nov 18, 20266
Nov 17, 20267
Nov 16, 20267
Nov 15, 202610
Nov 14, 20269
Nov 13, 20268
Nov 12, 202617
Nov 11, 202617
Nov 10, 202616
Nov 9, 202616
Nov 8, 202612
Nov 7, 202612
Nov 6, 202612
Nov 5, 20261
Nov 4, 20261
Nov 3, 20261
Nov 2, 20262
Nov 1, 20262
Oct 31, 20263
Oct 30, 20263
Oct 29, 20263
Oct 28, 20263
Oct 27, 20263
Oct 26, 20263
Oct 25, 20263
Oct 24, 20262
Oct 23, 20262
Oct 22, 20262
Oct 21, 20263
Oct 20, 20264
Oct 19, 20264
Oct 18, 20263
Oct 17, 20263
Oct 16, 20263
Oct 15, 20264
Oct 14, 20263
Oct 13, 20263
Oct 12, 20262
Oct 11, 20263
Oct 10, 20263
Oct 9, 20263
Oct 8, 20262
Oct 7, 20262
Oct 6, 20261
Oct 5, 20261
Oct 4, 20260
Oct 3, 20263
Oct 2, 20263
Oct 1, 20263
Sep 30, 20263
Sep 29, 202632
Sep 28, 202632
Sep 27, 202634
Sep 26, 202635
Sep 25, 202636
Sep 24, 202636
Sep 23, 202636
Sep 22, 202637
Sep 21, 202638
Sep 20, 202638
Sep 19, 202635
Sep 18, 202634
Sep 17, 202635
Sep 16, 202636
Sep 15, 20266
Sep 14, 20267
Sep 13, 20266
Sep 12, 20265
Sep 11, 20265
Sep 10, 20264
Sep 9, 20264
Sep 8, 20265
Sep 7, 20267
Sep 6, 20266

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

Health Score

23/100Poor

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

README

Payload Plugin Image Relationship

A Payload CMS plugin that enhances the relationship field to support image uploads.

Features

  • Replaces the default relationship field with a visual, gallery-style interface.
  • Displays image thumbnails for easy selection.
  • Efficiently handles large media libraries with paginated loading ("Load More").
  • Backend-powered search for fast and accurate filtering by alt text or filename.
  • Supports both hasMany: false (single selection) and hasMany: true (multiple selections).
  • Selected images are sorted and displayed first.
  • Collapsible interface to save screen space.
  • Shows a preview of selected images.

Screenshot

Payload Plugin Image Relationship Screenshot

Installation

pnpm install payload-plugin-image-relationship

or

npm install payload-plugin-image-relationship

or

yarn add payload-plugin-image-relationship

Usage

In your payload.config.ts, import the plugin and add it to the plugins array.

import { buildConfig } from 'payload/config';
import { imageRelationshipPlugin } from 'payload-plugin-image-relationship';
import { Media } from './collections/Media'; // Your media collection
import { Posts } from './collections/Posts'; // A collection with a relationship to Media

export default buildConfig({
  // ...
  collections: [Media, Posts],
  plugins: [
    imageRelationshipPlugin({
      // The 'relationTo' property should match the slug of your media collection
      relationTo: 'media',
    }),
  ],
  // ...
});

The relationTo option can be a single slug or an array of slugs. The plugin will apply the custom field component to any relationship or upload field that has a relationTo property matching one of the provided slugs.

Example of a relationship field in your collection:

// In your Posts collection
import { CollectionConfig } from 'payload/types';

export const Posts: CollectionConfig = {
  slug: 'posts',
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    {
      name: 'featuredImage',
      type: 'relationship',
      relationTo: 'media', // This must match the 'relationTo' in the plugin options
    },
  ],
};

Similar plugins