Adding New Menu in Payload

How to Create a New Menu in Payload ?

  1. Create a Custom Component: Create a React component for your new menu.

import { slateEditor } from ‘@payloadcms/richtext-slate’

import path from ‘path’

import type { CollectionConfig } from ‘payload/types’

export const Test: CollectionConfig = {

 slug: ‘test’,

 upload: {

  staticDir: path.resolve(__dirname, ‘../../../test’),

 },

 access: {

  read: () => true,

 },

 fields: [

  {

   name: ‘alt’,

   type: ‘text’,

   required: true,

  },

  {

   name: ‘caption’,

   type: ‘richText’,

   editor: slateEditor({

    admin: {

     elements: [‘link’],

    },

   }),

  },

 ],

}

This is created inside – srcpayloadcollectionsTest.ts

  1. inside config.js file Import the component and declare in collections.

import { Test } from ‘./collections/Test’

 collections: [Pages, Posts, Projects, Media, Categories, Users, Comments,Test],

This code will display the Menu in the payload admin dashboard sidemenu.

Leave a comment

Your email address will not be published. Required fields are marked *