The List View is where users interact with a list of Collection Documents within the Admin Panel. This is where they can view, sort, filter, and paginate their documents to find exactly what they're looking for. This is also where users can perform bulk operations on multiple documents at once, such as deleting, editing, or publishing many.
The List View can be swapped out in its entirety for a Custom View, or it can be injected with a number of Custom Components to add additional functionality or presentational elements without replacing the entire view.
To swap out the entire List View with a Custom View, use the admin.components.views.list property in your Collection Config:
Here is an example of a custom List View:
Custom List Views receive a different set of props than other views because Payload pre-fetches data and pre-renders components before passing the results to your component. The exact props available depend on whether you are building a Server or Client Component.
ListViewServerProps)Server components receive all client props plus the following additional server-only data:
Prop | Description |
|---|---|
| The sanitized Collection Config for this collection. |
| The paginated query result, including |
| The number of documents displayed per page. |
| Saved user preferences for this list (columns, sort, etc.). |
| The fields configured as searchable in the collection's admin options. |
| The i18n object. |
| The active locale, if localization is enabled. |
| Route parameters from the Next.js dynamic route. |
| The Payload class. |
| The current user's permissions. |
| URL search parameters (page, sort, where, limit, etc.). |
| The currently authenticated user. |
ListViewClientProps)Prop | Description |
|---|---|
| The slug of the collection being displayed. |
| An array of column definitions describing the current table columns and their state. |
| When |
| When |
| When |
| When |
| Whether the current user has permission to create new documents. |
| Whether the current user has permission to delete documents. |
| Whether the current user has permission to use the trash. |
| The URL to navigate to when creating a new document. |
| A |
| A |
| The current view type identifier. |
| A pre-rendered React node of the documents table. Pass this through to render the built-in table. |
| Slot for components rendered after the list. |
| Slot for components rendered after the table. |
| Slot for components rendered before the list. |
| Slot for components rendered before the table. |
| Slot for the collection description component. |
| Slot for custom items rendered in the list controls menu. |
If you want to keep Payload's built-in table and controls but add your own layout around them, import and render DefaultListView from @payloadcms/ui:
In addition to swapping out the entire List View with a Custom View, you can also override individual components. This allows you to customize specific parts of the List View without swapping out the entire view for your own.
To override List View components for a Collection, use the admin.components property in your Collection Config:
All slot components (beforeList, beforeListTable, afterList, afterListTable) receive the same base set of client props plus additional server-only props in Server Components:
Client Props (BeforeListClientProps, AfterListClientProps, etc.):
Prop | Description |
|---|---|
| The slug of the collection being displayed. |
| Whether the current user has permission to create new documents. |
| Whether the current user has permission to delete documents. |
| Whether the current user has permission to use the trash. |
| The URL to navigate to when creating a new document. |
Additional Server-Only Props (BeforeListServerProps, AfterListServerProps, etc.):
Prop | Description |
|---|---|
| The sanitized Collection Config for this collection. |
| The paginated query result, including |
| The number of documents displayed per page. |
| Saved user preferences for this list (columns, sort, etc.). |
| The fields configured as searchable in the collection's admin options. |
| The i18n object. |
| The Payload class. |
| The current user's permissions. |
| The currently authenticated user. |
The following options are available:
Path | Description |
|---|---|
| An array of custom components to inject before the list of documents in the List View. More details. |
| An array of custom components to inject before the table of documents in the List View. More details. |
| An array of custom components to inject after the list of documents in the List View. More details. |
| An array of custom components to inject after the table of documents in the List View. More details. |
| An array of components to render within a menu next to the List Controls (after the Columns and Filters options) |
| A component to render a description of the Collection. More details. |
The beforeList property allows you to inject custom components before the list of documents in the List View.
To add beforeList components, use the components.beforeList property in your Collection Config:
Here's an example of a custom beforeList component:
The beforeListTable property allows you to inject custom components before the table of documents in the List View.
To add beforeListTable components, use the components.beforeListTable property in your Collection Config:
Here's an example of a custom beforeListTable component:
The afterList property allows you to inject custom components after the list of documents in the List View.
To add afterList components, use the components.afterList property in your Collection Config:
Here's an example of a custom afterList component:
The afterListTable property allows you to inject custom components after the table of documents in the List View.
To add afterListTable components, use the components.afterListTable property in your Collection Config:
Here's an example of a custom afterListTable component:
The Description property allows you to render a custom description of the Collection in the List View.
To add a Description component, use the components.Description property in your Collection Config:
Here's an example of a custom Description component: