ObjectStackObjectStack

Notification

Notification protocol schemas

Notification Type Schema

Defines the visual presentation style of the notification.

Source: packages/spec/src/ui/notification.zod.ts

TypeScript Usage

import { Notification, NotificationAction, NotificationConfig, NotificationPosition, NotificationSeverity, NotificationType } from '@objectstack/spec/ui';
import type { Notification, NotificationAction, NotificationConfig, NotificationPosition, NotificationSeverity, NotificationType } from '@objectstack/spec/ui';

// Validate data
const result = Notification.parse(data);

Notification

Notification instance definition

Properties

PropertyTypeRequiredDescription
typeEnum<'toast' | 'snackbar' | 'banner' | 'alert' | 'inline'>Notification presentation style
severityEnum<'info' | 'success' | 'warning' | 'error'>Notification severity level
titlestring | ObjectoptionalNotification title
messagestring | ObjectNotification message body
iconstringoptionalIcon name override
durationnumberoptionalAuto-dismiss duration in ms, omit for persistent
dismissiblebooleanAllow user to dismiss the notification
actionsObject[]optionalAction buttons
positionEnum<'top_left' | 'top_center' | 'top_right' | 'bottom_left' | 'bottom_center' | 'bottom_right'>optionalOverride default position
ariaLabelstring | ObjectoptionalAccessible label for screen readers (WAI-ARIA aria-label)
ariaDescribedBystringoptionalID of element providing additional description (WAI-ARIA aria-describedby)
rolestringoptionalWAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")

NotificationAction

Notification action button

Properties

PropertyTypeRequiredDescription
labelstring | ObjectAction button label
actionstringAction identifier to execute
variantEnum<'primary' | 'secondary' | 'link'>Button variant style

NotificationConfig

Global notification system configuration

Properties

PropertyTypeRequiredDescription
defaultPositionEnum<'top_left' | 'top_center' | 'top_right' | 'bottom_left' | 'bottom_center' | 'bottom_right'>Default screen position for notifications
defaultDurationnumberDefault auto-dismiss duration in ms
maxVisiblenumberMaximum number of notifications visible at once
stackDirectionEnum<'up' | 'down'>Stack direction for multiple notifications
pauseOnHoverbooleanPause auto-dismiss timer on hover

NotificationPosition

Screen position for notification placement

Allowed Values

  • top_left
  • top_center
  • top_right
  • bottom_left
  • bottom_center
  • bottom_right

NotificationSeverity

Notification severity level

Allowed Values

  • info
  • success
  • warning
  • error

NotificationType

Notification presentation style

Allowed Values

  • toast
  • snackbar
  • banner
  • alert
  • inline

On this page