#Can't import icon from payload

6 messages · Page 1 of 1 (latest)

shadow magnet
#

I'm trying to create custom nav links for my custom routes. I was following this demo code:
https://github.com/payloadcms/payload/blob/master/test/admin/components/AfterNavLinks/index.tsx
And it says I can import { Chevron } from 'payload/components/icons';, but when I try to do so, it throws Error: Cannot find module '../src/admin/components/icons/Chevron'

It seems like the built code in node_modules is trying to export from its src directory, but it's not present in my node_module. Can you advise on how to use Payload's icons?

clever sigil
#

Maybe you can import from dist folder instead for now import Chevron from 'payload/dist/admin/components/icons/Chevron'

shadow magnet
#

thanks! it works for now.

#

I'll leave the question unanswered in case there are better ways to do this from the payload team, but this works fine for now.

drowsy perch
#

@shadow magnet All admin components are accessible from payload/components like this import { Chevron } from 'payload/components'; Looks like this should be mentioned in the admin component docs.

shadow magnet