Skip to main content

Notification class

📖 Description​

The Notification class defines a notification control for the Tripetto builder. It is derived from the Control class.

📺 Preview​


🆕 constructor​

Creates a new Notification instance.

Signature​

constructor(
label: string,
type?: "normal" | "info" | "success" | "warning" | "error",
style?: INotificationStyle
): Notification

Parameters​

NameTypeOptionalDescription
labelstringNoSpecifies the label to show.
type"normal" | "info" | "success" | "warning" | "error"YesSpecifies the type.
styleINotificationStyleYesSpecifies the notification style (when omitted the default global style will be used).

Return value​

Returns a reference to the new Notification instance.

📌 Statics​


🏷️ style​

Contains the global default style for the notification control.

Type​

INotificationStyle

🗃️ Fields​


🏷️ isDisabled​

Sets or retrieves if the control is disabled.

Type​

boolean


🏷️ isVisible​

Sets or retrieves the visibility of the control.

Type​

boolean


🏷️ notificationType​

Sets or retrieves the notification type.

Type​

"normal" | "info" | "success" | "warning" | "error"


🏷️ style​

Contains the style for the notification control.

Type​

INotificationStyle

▶️ Methods​


🔧 disable​

Disables the control.

Signature​

disable(): this

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 disabled​

Specifies the state of the control.

Signature​

disabled(disabled?: boolean): this

Parameters​

NameTypeOptionalDescription
disabledbooleanYesSpecifies if the control is disabled (default is true).

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 enable​

Enables the control.

Signature​

enable(): this

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 hide​

Hides the control.

Signature​

hide(): this

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 indent​

Enables control indentation. This can only be set during construction.

Signature​

indent(size: number): this

Parameters​

NameTypeOptionalDescription
sizenumberNoSpecifies the indent size in pixels.

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 show​

Shows the control.

Signature​

show(): this

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 type​

Specifies the notification type.

Signature​

type(type: "normal" | "info" | "success" | "warning" | "error"): this

Parameters​

NameTypeOptionalDescription
type"normal" | "info" | "success" | "warning" | "error"NoSpecifies the type.

Return value​

Returns a reference to the Notification instance to allow chaining.


🔧 visible​

Specifies the visibility of the control.

Signature​

visible(visible?: boolean): this

Parameters​

NameTypeOptionalDescription
visiblebooleanYesSpecifies if the control is visible (default is true).

Return value​

Returns a reference to the Notification instance to allow chaining.

⛓️ Interfaces​


🔗 INotificationStyle​

Describes the interface for the notification styles.

Type declaration​

interface INotificationStyle {
/* Notification appearance. */
appearance?: IStyles;

/* Notification appearance when fused with the form card. */
fused?: IStyles;

/* Normal notification. */
normal?: IStyles;

/* Info notification. */
info?: IStyles;

/* Success notification. */
success?: IStyles;

/* Warning notification. */
warning?: IStyles;

/* Error notification. */
error?: IStyles;
}