I have this example but I was hoping for a more custom way to do it. For example I don't want to display a Product like that with its ID but all of the Product's fields. How would I do that?
import React from "react";
import Example from "payload/dist/admin/components/views/collections/List/Default";
import { Props } from "payload/dist/admin/components/views/collections/List/types";
function ProductsList(props: Props) {
return (
<Example
collection={props.collection}
columnNames={props.columnNames}
data={props.data}
hasCreatePermission={props.hasCreatePermission}
limit={props.limit}
newDocumentURL={props.newDocumentURL}
setColumns={props.setColumns}
setListControls={props.setListControls}
setSort={props.setSort}
tableColumns={props.tableColumns}
setLimit={props.setLimit}
/>
);
}
export { ProductsList };You can use your own custom
Listcomponent to do this, read a bit more about this here:
https://payloadcms.com/docs/admin/components#collectionsBasically, on your upload collection you will need to add
admin: { views: { List: ProductsList } }yes i'm doing this but i meant i want to access the default Upload list component that Payload provides me, so that i can edit parts of it. i don't want to build the component from scratch or only change some props. for example i want to change the shape of that Product in the image to be horizontal and including other fields
if that's possible
i imported views/collections/List/Default but i can't customize it any more than change its props like collection and columnNames, etc.
Sure that makes sense. Currently you would have to copy that file (ensure import paths are updated to point to dist instead of relative paths) and then swap out the UploadGallery with your own gallery component.
I think in the future, uploads will change - either we go with list/grid display (option toggle) or just align the upload gallery so it matches the collection lists
Star
Discord
online
Get dedicated engineering support directly from the Payload team.