Skip to content

Notification

A Notification gives people timely, high-value information they can understand at a glance.

Component preview

Summary

Properties

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. Automatically uppercased.
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.

View all inherited from BaseComponent

View all inherited from Frame

Methods

Name Signature Description
Close (self: Notification, fromUserInput: boolean?) -> nil Manually dismisses the notification.
UpdateState (self: Notification, age: number, instant: boolean?) -> nil Updates the notification's visual state for its position in the stack.

View all inherited from Frame

Events

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

View all inherited from Frame

Types

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

type Notification = BaseComponent & Components & NotificationProperties & {
    Close: (self: Notification, fromUserInput: boolean?) -> nil,
    UpdateState: (self: Notification, age: number, instant: boolean?) -> nil,
}

Function Signature

function(self, properties: NotificationProperties?): Notification

Example

local notification = app:Notification({
    App = "CHAT",
    AppIcon = "rbxassetid://132228700346004",

    Title = "New Message",
    Subtitle = "You received a new message from a friend.",
    Icon = cascade.Symbols.bell, -- Icon appears beside the title label.

    Duration = 5,

    Closed = function(self, fromUserInput)
        print("Notification was dismissed! (from user: " .. tostring(fromUserInput) .. ")")
    end
})

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