Customising the appearance of the Relationship field #2457
-
Hello! I've just started using Payload today and it's ridiculous how quickly I can get a lot of things done. I was hoping someone might be able to give me some advice on where to start with customising the Relationship field. I'd like to be able to better distinguish between the data items that get added to the field e.g. changing the colour or adding icons. I had a look through the Payload repository, but wasn't sure which file represented the root Relationship component. I'm probably biting off way more than I can chew as a beginner... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
I love that you are tenatiously getting after it, even if it is more than you can "chew as a beginner"! Here is a link to the field component that Payload uses as a default: https://github.com/payloadcms/payload/blob/master/src/admin/components/forms/field-types/Relationship/index.tsx Good luck and do ask followup questions if you get stuck! |
Beta Was this translation helpful? Give feedback.
I love that you are tenatiously getting after it, even if it is more than you can "chew as a beginner"!
You can start by copying the existing Default relationship component code into a new file in your project and make your own edits there. Then you will import and set that as your
admin.components.Field
for the relationship field(s) of your collection config.Here is a link to the field component that Payload uses as a default: https://github.com/payloadcms/payload/blob/master/src/admin/components/forms/field-types/Relationship/index.tsx
Good luck and do ask followup questions if you get stuck!