Skip to main content
5.0.3Next5.0.35.0.25.0.15.0.04.0.94.0.84.0.73.2.03.1.03.0.13.0.02.1.12.0.101.0.0
Version: 5.0.3

Notification

Notifications are used to notify users of an event or communicate changes as a result of user actions. For instance if an error needs to be displayed to the user, a notification could be used, or one could use notifications to tell the user that their form was submitted sucessfully. Notifications often serve to provide user feedback.

Basic Usage

<triton-notification>
Notification text
</triton-notification>
<TritonNotification>
Notification text
</TritonNotification>
<html> 
<head>
<script type="module">
import { defineCustomElements } from '~node_modules/@kognifai/triton-cl-core/loader/index.es2017.js';
defineCustomElements();
</script>
</head>
<body>
<triton-notification>
Notification text
</triton-notification>
</body>
</html>
Notification text

Behavior

Timeout

The component emits a void-type event with name atClose after a specified timeout provided in milliseconds. The same event is triggered when the user attempts to manually dismiss the notification.

Fire Notification
<triton-notification timeout="5000">
This notification will time out soon!
</triton-notification>

Appearance

Custom Icon

Pass a valid TritonIcon name to the custom-icon property to set a custom icon in the notification.

This notification has a custom icon!
<triton-notification customIcon="map"> 
This notification has a custom icon!
</triton-notification>

Skin

Use the skin property to set an appropriate skin for the type of noticiation. This also sets the icon. Certain skins have variants for both day and dusk theme.

Hello, neutral skinHello, information skinHello, success skinHello, flat skin. We don't even have shadows here.Hello, warning skinHello, alarm skin Hello, critical skin
<triton-notification skin="neutral">Hello, neutral skin</triton-notification>
<triton-notification skin="information">Hello, information skin</triton-notification>
...

Playground

API

Properties

PropertyDescriptionTypeDefault
custom-iconOverride icon in notification with icon stringIcon-
elevationShadow applied to the card for elevation2 3 4'3'
fluidIf true, the element fills all available widthbooleanfalse
show-closeIf false, the notification will not have the x button that lets the user close itbooleantrue
sizeSet the size of the componentbase body large medium small tiny xlarge xxlarge xxxlarge'body'
skinSet the skin of the component from preset optionsThe skin determines how the component looksalarm critical flat information neutral primary secondary success warning'primary'
timeoutMilliseconds to self-close. Emits atClose event on timeout.number-1

Events

NameTypeDescriptionExtra
atCloseCustomEvent<void>Dispatched void-type event when notificationis closed manually or times out-

Slots

Main

This slot can take any markup element.

<triton-notification>
<div></div>
</triton-notification>

Details

Depends on