Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

How to create a custom NavGroup?

default discord avatar
backpain10356 months ago
2

I tried to do exactly this



https://discord.com/channels/967097582721572934/1215659716538273832/1253304569283215382

And I got the same error...



Does anyone has a template?



yeah, i noticed, its not a server component because of the 'use client'; still didn't know to solve the problem



https://github.com/payloadcms/payload/blob/59ff8c18f5ff602e872cc65ea03e68bf8071b20b/packages/ui/src/elements/NavGroup/index.tsx#L31

you can check there is a getPreference here, and that'is where the error is coming from



import Link from "next/link";
import { NavGroup } from '@payloadcms/ui'
import { ServerProps } from "payload";


const CustomNavGroup = ({ payload }: ServerProps) => {
  const { admin } = payload.config.routes;

  return (
    <NavGroup label={"Custom"}>
      <Link className="nav__link" href={`${admin}/custompage`}>
        <span className="nav__link-label">Custom Page</span>
      </Link>
    </NavGroup>
  )
};

export default CustomNavGroup;
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.