Skip to content

Notification

A Notification is a non-disruptive, transient message that appears on screen to alert the user of important information, events, or state changes within an application.

Summary

Properties

View all inherited from BaseComponent

View all inherited from Frame

Name Type Description
Title string The primary headline of the notification.
Subtitle string The secondary text providing more context.
App string? Optional text to display what feature or app triggered the notification.
AppIcon string? Optional image asset ID to show an icon in the top left.
Icon string? Optional image asset ID to show an icon in the top left, next to the title.
Duration number? How long (in seconds) the notification remains before auto-closing. Defaults to 6. Use 0 for manual close only.

Methods

View all inherited from Frame

Name Returns Description
Close() nil Manually dismisses the notification.

Events

View all inherited from Frame

Name Parameters Description
Closed (self: Notification, fromUser: boolean) Fired when the notification is closed either via timeout or by the user.

Types

type NotificationProperties = Frame & {
    Title: string,
    Subtitle: string,
    App: string?,
    Icon: string?,
    AppIcon: string?,
    Duration: number?,
    Closed: ((self: Notification, fromUser: boolean) -> unknown)?,
}

type Notification = BaseComponent & Components & NotificationProperties & {
    Close: (self: Notification) -> nil,
}

Function Signature

function(self, properties: NotificationProperties): Notification

Example

local notification = app:Notification({
    Title = "New Message",
    Subtitle = "You received a new message from a friend.",
    App = "CHAT",
    Icon = cascade.Symbols.bell,
    AppIcon = "rbxassetid://132228700346004",
    Duration = 5,
    Closed = function(self, fromUser)
        print("Notification was dismissed! (from user: " .. tostring(fromUser) .. ")")
    end
})

-- Sometime later, if you need to manually close it:
-- notification:Close()