# Open, Close and Hide Notifications

This article explains how to open, close and hide the Notification component. For brevity, it will be divided in the following sections:

* [Open](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#open)
  * [Use Only the Text and ThemeColor Properties](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#use-only-the-text-and-themecolor-properties)
  * [Pass a NotificationModel to the Method](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#pass-a-notificationmodel-to-the-method)
* [Close and Hide](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#close-and-hide)
  * [Automatically Closing a Notification](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#automatically-closing-a-notification)
  * [Manually Closing a Notification](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#manually-closing-a-notification)

## Open

You can open (show) the Notification component by using the `Show` method of its reference.

You can use it in two ways:

* [Use Only the Text and ThemeColor Properties](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#use-only-the-text-and-themecolor-properties)
* [Pass a NotificationModel to the Method](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#pass-a-notificationmodel-to-the-method)

You can also [show all notifications for your app from a single instance](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#show-from-anywhere) so they all [stack together](https://www.telerik.com/blazor-ui/documentation/components/notification/stacked-notifications) and also stay between page navigations.

### Use Only the Text and ThemeColor Properties

If you do not need to customize the [closing](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#close-and-hide) or the icon of the component you can quickly create them by passing only what text and [theme color](https://www.telerik.com/blazor-ui/documentation/components/notification/appearance#themecolor) should the Notification have.

<demo metaUrl="client/notification/open-close-hide/open-text/" height="300"></demo>

### Pass a NotificationModel to the Method

You can pass the entire [NotificationModel](https://www.telerik.com/blazor-ui/documentation/components/notification/overview#notificationmodel-class-properties) to provide detailed information for the component - whether it should be closable or specify the icon.

<demo metaUrl="client/notification/open-close-hide/open-model/" height="300"></demo>

### Show From Anywhere

You can declare a single notification instance in the main layout of your app and pass it down to all components in the app so they can all show notifications if they need to. You can find an example implementation in the [One Notification Instance for All Components](https://github.com/telerik/blazor-ui/tree/master/notification/single-instance-per-app) sample project.

## Close and Hide

There are two separate ways to close a notification:

* [Automatically Closing Notification](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#automatically-closing-a-notification)
* [Manually Closing a Notification](https://www.telerik.com/blazor-ui/documentation/components/notification/open-close-hide#manually-closing-a-notification)

### Automatically Closing a Notification

By default each notification is an automatically closing one. You can define the time it stays visible by adjusting the `CloseAfter` parameter of the [NotificationModel](https://www.telerik.com/blazor-ui/documentation/components/notification/overview#notificationmodel-class-properties). It defaults to `5000ms`.

You can also let the user dismiss a notification message before that timer elapses through a closing button by setting the `Closable` parameter of the `NotificationModel` to `true` (its default value).

> caption Automatically Closing Notification

<demo metaUrl="client/notification/open-close-hide/automatic/" height="300"></demo>

### Manually Closing a Notification

You can prevent the notification from closing automatically and let the user close it with the close button only. To do so, in the `NotificationModel` instance, set the `Closable` parameter to `true` and the `CloseAfter` parameter to `0`.

> caption Manually Closing Notification

<demo metaUrl="client/notification/open-close-hide/manual/" height="300"></demo>

## Hide All Notifications

To hide all notifications, you use the `HideAll` method. This function enables you to easily and quickly close all notifications at once.

> caption Hide All Notifications

<demo metaUrl="client/notification/open-close-hide/hide-all/" height="300"></demo>

## See Also

* [Keep Notifications Visible on Hover](https://www.telerik.com/blazor-ui/documentation/knowledge-base/notification-keep-on-hover)
* [Notification Overview](https://www.telerik.com/blazor-ui/documentation/components/notification/overview)
