#Admin custom components

5 messages · Page 1 of 1 (latest)

rocky moss
#

Hey guys. I'm trying to create a custom UI for the collections form in the admin portal rather than using payloads default UI. I tried overriding the styles but it's just not that easy. I want a change in UI but the way payload handles the component should be the sameap. I was thinking of creating custom components at this point but not sure what the best practice would be here. Any doc or guidance would be appreciated

tulip minnow
#

what exactly do you want to change?
there are multiple layers to customizing the admin panel in Payload.

Views:

custom view = replace the whole page
custom components = replace or inject specific parts of the existing view

For example in the Edit View docs:
https://payloadcms.com/docs/custom-components/edit-view

You can override things like:

saveButton → replace the save button
beforeDocumentControls → add another button next to the save button

Fields:
You can also customize field rendering per collection/field type.

Field component = how it renders in edit view
Cell component = how it renders in list view

Docs:
https://payloadcms.com/docs/fields/overview#custom-components

If you mainly want visual/style changes, overriding CSS might still be easier than replacing the whole form UI, especially if you want to keep Payload’s built-in form state/validation/submission handling.

I also made a small style generator tool before:
https://payloadtwist.com/editor

Not perfect, but it can help generate custom admin styles.

here you can find examples of how to create custom components : https://github.com/payloadcms/payload/tree/main/examples/custom-components
hopefully in v4 soon things will be much easier 😄

still lion
#

I added a patch through pnpm to remove the primary stylesheet because a few of the css rules were marked important and I for the life of me couldn't figure out how to override them.

rocky moss
# tulip minnow what exactly do you want to change? there are multiple layers to customizing the...

Thanks for getting back to me. Here is a snippet as an example. I wanted to change the UI but the functionality of payload should stay the same. Right now even if I override css it's breaking stuff in unknown places which is a pain. In my case I think replacing the whole component makes sense. I really hope things get better in version 4 cuz it's not that easy to work with UI. Thank you for sending those docs it was helpful 🙂