---
title: Edit View
label: Edit View
order: 60
desc:
keywords: admin, components, custom, documentation, Content Management System, cms, headless, javascript, node, react, nextjs
---

The Edit View is where users interact with individual [Collection](../configuration/collections) and [Global](../configuration/globals) Documents within the [Admin Panel](../admin/overview). The Edit View contains the actual form in which submits the data to the server. This is where they can view, edit, and save their content. It contains controls for saving, publishing, and previewing the document, all of which can be customized to a high degree.

The Edit 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.

<Banner type="warning">
  **Note:** The Edit View is one of many [Document Views](./document-views) in
  the Payload Admin Panel. Each Document View is responsible for a different
  aspect of the interacting with a single Document.
</Banner>

## Custom Edit View

To swap out the entire Edit View with a [Custom View](./custom-views), use the `views.edit.default` property in your [Collection Config](../configuration/collections) or [Global Config](../configuration/globals):

```tsx
import { buildConfig } from 'payload'

const config = buildConfig({
  // ...
  admin: {
    components: {
      views: {
        edit: {
          // highlight-start
          default: {
            Component: '/path/to/MyCustomEditViewComponent',
          },
          // highlight-end
        },
      },
    },
  },
})
```

Here is an example of a custom Edit View:

#### Server Component

```tsx
import React from 'react'
import type { DocumentViewServerProps } from 'payload'

export function MyCustomServerEditView(props: DocumentViewServerProps) {
  return <div>This is a custom Edit View (Server)</div>
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import type { DocumentViewClientProps } from 'payload'

export function MyCustomClientEditView(props: DocumentViewClientProps) {
  return <div>This is a custom Edit View (Client)</div>
}
```

_For details on how to build Custom Views, including all available props, see [Building Custom Views](./custom-views#building-custom-views)._

## Custom Components

In addition to swapping out the entire Edit View with a [Custom View](./custom-views), you can also override individual components. This allows you to customize specific parts of the Edit View without swapping out the entire view.

<Banner type="warning">
  **Important:** Collection and Globals are keyed to a different property in the
  `admin.components` object have slightly different options. Be sure to use the
  correct key for the entity you are working with.
</Banner>

#### Collections

To override Edit View components for a Collection, use the `admin.components.edit` property in your [Collection Config](../configuration/collections):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      // highlight-start
      edit: {
        // ...
      },
      // highlight-end
    },
  },
}
```

The following options are available:

| Path                     | Description                                                                                          |
| ------------------------ | ---------------------------------------------------------------------------------------------------- |
| `beforeDocumentControls` | Inject custom components before the Save / Publish buttons. [More details](#beforedocumentcontrols). |
| `SaveButton`             | A button that saves the current document. [More details](#savebutton).                               |
| `SaveDraftButton`        | A button that saves the current document as a draft. [More details](#savedraftbutton).               |
| `PublishButton`          | A button that publishes the current document. [More details](#publishbutton).                        |
| `PreviewButton`          | A button that previews the current document. [More details](#previewbutton).                         |
| `Description`            | A description of the Collection. [More details](#description).                                       |
| `Upload`                 | A file upload component. [More details](#upload).                                                    |

#### Globals

To override Edit View components for Globals, use the `admin.components.elements` property in your [Global Config](../configuration/globals):

```ts
import type { GlobalConfig } from 'payload'

export const MyGlobal: GlobalConfig = {
  // ...
  admin: {
    components: {
      // highlight-start
      elements: {
        // ...
      },
      // highlight-end
    },
  },
}
```

The following options are available:

| Path                     | Description                                                                                          |
| ------------------------ | ---------------------------------------------------------------------------------------------------- |
| `beforeDocumentControls` | Inject custom components before the Save / Publish buttons. [More details](#beforedocumentcontrols). |
| `SaveButton`             | A button that saves the current document. [More details](#savebutton).                               |
| `SaveDraftButton`        | A button that saves the current document as a draft. [More details](#savedraftbutton).               |
| `PublishButton`          | A button that publishes the current document. [More details](#publishbutton).                        |
| `PreviewButton`          | A button that previews the current document. [More details](#previewbutton).                         |
| `Description`            | A description of the Global. [More details](#description).                                           |

### SaveButton

The `SaveButton` property allows you to render a custom Save Button in the Edit View.

To add a `SaveButton` component, use the `components.edit.SaveButton` property in your [Collection Config](../configuration/collections) or `components.elements.SaveButton` in your [Global Config](../configuration/globals):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      edit: {
        // highlight-start
        SaveButton: '/path/to/MySaveButton',
        // highlight-end
      },
    },
  },
}
```

Here's an example of a custom `SaveButton` component:

#### Server Component

```tsx
import React from 'react'
import { SaveButton } from '@payloadcms/ui'
import type { SaveButtonServerProps } from 'payload'

export function MySaveButton(props: SaveButtonServerProps) {
  return <SaveButton label="Save" />
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import { SaveButton } from '@payloadcms/ui'
import type { SaveButtonClientProps } from 'payload'

export function MySaveButton(props: SaveButtonClientProps) {
  return <SaveButton label="Save" />
}
```

### beforeDocumentControls

The `beforeDocumentControls` property allows you to render custom components just before the default document action buttons (like Save, Publish, or Preview). This is useful for injecting custom buttons, status indicators, or any other UI elements before the built-in controls.

To add `beforeDocumentControls` components, use the `components.edit.beforeDocumentControls` property in you [Collection Config](../configuration/collections) or `components.elements.beforeDocumentControls` in your [Global Config](../configuration/globals):

#### Collections

```
export const MyCollection: CollectionConfig = {
  admin: {
    components: {
      edit: {
        // highlight-start
        beforeDocumentControls: ['/path/to/CustomComponent'],
        // highlight-end
      },
    },
  },
}
```

#### Globals

```
export const MyGlobal: GlobalConfig = {
  admin: {
    components: {
      elements: {
        // highlight-start
        beforeDocumentControls: ['/path/to/CustomComponent'],
        // highlight-end
      },
    },
  },
}
```

Here's an example of a custom `beforeDocumentControls` component:

#### Server Component

```tsx
import React from 'react'
import type { BeforeDocumentControlsServerProps } from 'payload'

export function MyCustomDocumentControlButton(
  props: BeforeDocumentControlsServerProps,
) {
  return <div>This is a custom beforeDocumentControl button (Server)</div>
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import type { BeforeDocumentControlsClientProps } from 'payload'

export function MyCustomDocumentControlButton(
  props: BeforeDocumentControlsClientProps,
) {
  return <div>This is a custom beforeDocumentControl button (Client)</div>
}
```

### SaveDraftButton

The `SaveDraftButton` property allows you to render a custom Save Draft Button in the Edit View.

To add a `SaveDraftButton` component, use the `components.edit.SaveDraftButton` property in your [Collection Config](../configuration/collections) or `components.elements.SaveDraftButton` in your [Global Config](../configuration/globals):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      edit: {
        // highlight-start
        SaveDraftButton: '/path/to/MySaveDraftButton',
        // highlight-end
      },
    },
  },
}
```

Here's an example of a custom `SaveDraftButton` component:

#### Server Component

```tsx
import React from 'react'
import { SaveDraftButton } from '@payloadcms/ui'
import type { SaveDraftButtonServerProps } from 'payload'

export function MySaveDraftButton(props: SaveDraftButtonServerProps) {
  return <SaveDraftButton />
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import { SaveDraftButton } from '@payloadcms/ui'
import type { SaveDraftButtonClientProps } from 'payload'

export function MySaveDraftButton(props: SaveDraftButtonClientProps) {
  return <SaveDraftButton />
}
```

### PublishButton

The `PublishButton` property allows you to render a custom Publish Button in the Edit View.

To add a `PublishButton` component, use the `components.edit.PublishButton` property in your [Collection Config](../configuration/collections) or `components.elements.PublishButton` in your [Global Config](../configuration/globals):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      edit: {
        // highlight-start
        PublishButton: '/path/to/MyPublishButton',
        // highlight-end
      },
    },
  },
}
```

Here's an example of a custom `PublishButton` component:

#### Server Component

```tsx
import React from 'react'
import { PublishButton } from '@payloadcms/ui'
import type { PublishButtonClientProps } from 'payload'

export function MyPublishButton(props: PublishButtonServerProps) {
  return <PublishButton label="Publish" />
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import { PublishButton } from '@payloadcms/ui'
import type { PublishButtonClientProps } from 'payload'

export function MyPublishButton(props: PublishButtonClientProps) {
  return <PublishButton label="Publish" />
}
```

### PreviewButton

The `PreviewButton` property allows you to render a custom Preview Button in the Edit View.

To add a `PreviewButton` component, use the `components.edit.PreviewButton` property in your [Collection Config](../configuration/collections) or `components.elements.PreviewButton` in your [Global Config](../configuration/globals):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      edit: {
        // highlight-start
        PreviewButton: '/path/to/MyPreviewButton',
        // highlight-end
      },
    },
  },
}
```

Here's an example of a custom `PreviewButton` component:

#### Server Component

```tsx
import React from 'react'
import { PreviewButton } from '@payloadcms/ui'
import type { PreviewButtonServerProps } from 'payload'

export function MyPreviewButton(props: PreviewButtonServerProps) {
  return <PreviewButton />
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import { PreviewButton } from '@payloadcms/ui'
import type { PreviewButtonClientProps } from 'payload'

export function MyPreviewButton(props: PreviewButtonClientProps) {
  return <PreviewButton />
}
```

### Description

The `Description` property allows you to render a custom description of the Collection or Global in the Edit View.

To add a `Description` component, use the `components.edit.Description` property in your [Collection Config](../configuration/collections) or `components.elements.Description` in your [Global Config](../configuration/globals):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      // highlight-start
      Description: '/path/to/MyDescriptionComponent',
      // highlight-end
    },
  },
}
```

<Banner type="warning">
  **Note:** The `Description` component is shared between the Edit View and the
  [List View](./list-view).
</Banner>

Here's an example of a custom `Description` component:

#### Server Component

```tsx
import React from 'react'
import type { ViewDescriptionServerProps } from 'payload'

export function MyDescriptionComponent(props: ViewDescriptionServerProps) {
  return <div>This is a custom description component (Server)</div>
}
```

#### Client Component

```tsx
'use client'
import React from 'react'
import type { ViewDescriptionClientProps } from 'payload'

export function MyDescriptionComponent(props: ViewDescriptionClientProps) {
  return <div>This is a custom description component (Client)</div>
}
```

### Upload

The `Upload` property allows you to render a custom file upload component in the Edit View.

To add an `Upload` component, use the `components.edit.Upload` property in your [Collection Config](../configuration/collections):

```ts
import type { CollectionConfig } from 'payload'

export const MyCollection: CollectionConfig = {
  // ...
  admin: {
    components: {
      edit: {
        // highlight-start
        Upload: '/path/to/MyUploadComponent',
        // highlight-end
      },
    },
  },
}
```

<Banner type="warning">
  **Note:** The Upload component is only available for Collections.
</Banner>

Here's an example of a custom `Upload` component:

```tsx
import React from 'react'

export function MyUploadComponent() {
  return <input type="file" />
}
```
