Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/admin/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ The `admin.toast` configuration allows you to customize the handling of toast me

The following options are available for the `admin.toast` configuration:

| Option | Description | Default |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | ------- |
| `duration` | The length of time (in milliseconds) that a toast message is displayed. | `4000` |
| `expand` | If `true`, will expand the message stack so that all messages are shown simultaneously without user interaction. | `false` |
| `limit` | The maximum number of toasts that can be visible on the screen at once. | `5` |
| Option | Description | Default |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | -------------- |
| `duration` | The length of time (in milliseconds) that a toast message is displayed. | `4000` |
| `expand` | If `true`, will expand the message stack so that all messages are shown simultaneously without user interaction. | `false` |
| `limit` | The maximum number of toasts that can be visible on the screen at once. | `5` |
| `position` | The position of the toast on the screen. | `bottom-right` |
11 changes: 11 additions & 0 deletions packages/payload/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,17 @@ export type Config = {
* @default 5
*/
limit?: number
/**
* The position of the toast on the screen.
* @default 'bottom-right'
*/
position?:
| 'bottom-center'
| 'bottom-left'
| 'bottom-right'
| 'top-center'
| 'top-left'
| 'top-right'
}
/** The slug of a Collection that you want to be used to log in to the Admin dashboard. */
user?: string
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/providers/ToastContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Warning } from './icons/Warning.js'
export const ToastContainer: React.FC<{
config: ClientConfig
}> = ({ config }) => {
const { admin: { toast: { duration, expand, limit } = {} } = {} } = config
const { admin: { toast: { duration, expand, limit, position } = {} } = {} } = config

return (
<Toaster
Expand All @@ -30,6 +30,7 @@ export const ToastContainer: React.FC<{
warning: <Warning />,
}}
offset="calc(var(--gutter-h) / 2)"
position={position ?? 'bottom-right'}
toastOptions={{
classNames: {
closeButton: 'payload-toast-close-button',
Expand Down
Loading