Skip to content

6.9. NotificationNFormView

Elly Kitoto edited this page Jul 27, 2020 · 2 revisions

Toast Notification widget

This view is used to display toast notification of types info, error, warning and success. This widget is rendered by declaring type toast_notification in the JSON.

All JSON attributes are represented as a String literals

Field attributes

Field Attribute Usage Required
name Name of the field yes
type Type of the field yes
properties View attributes yes

Supported view attributes

Mostly matching the attributes on the XML but using snake case.

View Attribute Usage Required
notification_type Type of notification (info, success, warning error) yes
text Notification message yes
dismissible Indicate whether the notification can be closed no
title Notification title no
notification_dialog_title Title of the alert dialog no
notification_dialog_text Text shown as alert dialog message no
background_color Background color of the notification (use this for custom notifications) no
text_color Color of the notification text no

Example JSON

[
  {
    "name": "info_toast_notification",
    "type": "toast_notification",
    "properties": {
      "notification_type": "info",
      "dismissible": "yes",
      "title": "Info toast",
      "text": "Hey Morty! Morty I turned myself into a pickle. Am a pickle Rick!",
      "notification_dialog_title": "Wubba Lubba Dub Dub",
      "notification_dialog_text": "I am in great pain, please help me!!"
    }
  },
  {
    "name": "success_toast_notification",
    "type": "toast_notification",
    "properties": {
      "notification_type": "success",
      "dismissible": "yes",
      "title": "Success toast",
      "text": "Hey Morty! Morty I turned myself into a pickle. Am a pickle Rick!",
      "notification_dialog_title": "Wubba Lubba Dub Dub",
      "notification_dialog_text": "I am in great pain, please help me!!"
    }
  },
  {
    "name": "warning_toast_notification",
    "type": "toast_notification",
    "properties": {
      "notification_type": "warning",
      "dismissible": "yes",
      "title": "Warning toast",
      "text": "Hey Morty! Morty I turned myself into a pickle. Am a pickle Rick!",
      "notification_dialog_title": "Wubba Lubba Dub Dub",
      "notification_dialog_text": "I am in great pain, please help me!!"
    }
  },
  {
    "name": "error_toast_notification",
    "type": "toast_notification",
    "properties": {
      "notification_type": "error",
      "dismissible": "yes",
      "title": "Error toast",
      "text": "Hey Morty! Morty I turned myself into a pickle. Am a pickle Rick!",
      "notification_dialog_title": "Wubba Lubba Dub Dub",
      "notification_dialog_text": "I am in great pain, please help me!!"
    }
  },
  {
    "name": "custom_toast_notification",
    "type": "toast_notification",
    "properties": {
      "notification_type": "info",
      "dismissible": "no",
      "title": "Custom toast: {test_calculation}",
      "text": "Hey Morty! Morty I turned myself into a pickle. Am a pickle Rick! \n\nDecade from age: {decade_calculation}",
      "background_color": "#082455",
      "text_color": "#EBEE2F"
    }
  }
]

Field Validation

Not accessible for this widget

Field Value

Not applicable for this widget

Required Status

Not applicable for this widget

Calculations

You can pass dynamic text on notification title and text. To achieve this wrap the calculation with curly braces {}. The text/title on the notification will be updated real time when that calculation changes.

Example is the custom_toast_notification sample in the JSON above. When test_calculation changes, the notification title is updated.