Skip to content

Kirby 3.5.7.1

Store: notification

Trigger success and error notifications in the topbar

We use Vuex to ensure a consistent state of data throughout the Panel. If you have not worked with Vuex before, you should first familiarize yourself with their documentation.

State

this.$store.state.notification
Key Description
type Type of the current notification (error, success)
message The notification message shown in the topbar
details Additional attributes for the notification. Not used yet
timeout Time in milliseconds until the notification gets hidden again
// example of store state
{
  type: "error",
  message: "The page could not be deleted",
  details: null,
  timeout: 4000
}

Actions

notification/close

Closes the current notification

this.$store.dispatch("notification/close")

notification/open

Opens a new notification

this.$store.dispatch("notification/open", {
  type: "success",
  message: "Yay, it worked",
  timeout: 5000
});

notification/success

Trigger a success notification

this.$store.dispatch("notification/success", "Yay, it worked");

notification/error

Trigger an error notification

this.$store.dispatch("notification/error", "Nooooooo!");