bootstack.Notification#

class bootstack.Notification(title=None, *, message=None, detail=None, corner=None, accent=None, icon=None, on_dismiss=None)#

Bases: object

A persistent corner message the user closes themselves.

Like a toast, a notification floats in a screen corner and stacks — but it does not auto-dismiss. It carries a close button and stays until the user closes it or your code calls dismiss(). Use it for information that should persist (a finished background job, an available update) rather than flash by. Build it, then call show().

Notifications are message-only — for a response, use a Snackbar action or a dialog.

Parameters:
  • title (str | None) – Header text — the notification’s headline.

  • message (str | None) – Body text shown below the title.

  • detail (str | None) – Small muted metadata shown in the header (e.g. 'just now').

  • corner (ToastCorner | None) – Screen corner to anchor to — 'top-left', 'top-right', 'bottom-left', or 'bottom-right'. Defaults to the top-right.

  • accent (AccentToken | str | None) – Semantic color accent. Defaults to a neutral surface.

  • icon (Icon | None) – Optional Bootstrap Icons name or an icon spec dict, shown before the title. No icon is shown unless given.

  • on_dismiss (Callable[[], Any] | None) – Called with no arguments when the notification closes.

dismiss()#

Close the notification immediately.

show()#

Display the notification. Returns self for chaining.