# Notification

If you need to display feedback to a user in-app you should use a banner notification. These are perfect for displaying unobtrusive messages at the top of the viewport, such as when a form error occurs or an action has been completed successfully.

{% hint style="info" %}
If you want to send notifications when the user hasn't opened your app, you should use a [Push Notification](/gravity-native/push-notifications.md).
{% endhint %}

## Showing Banner Notifications

You can show banner notifications from anywhere in your application using the [AppContext](/gravity-native/app-context.md).

### Preview

<div align="left"><figure><img src="/files/OV3XaGxzYZiMga3dyMIx" alt="" width="563"><figcaption></figcaption></figure></div>

### Code

```javascript
// structure
context.banner.show(message, type, autoclose);

// example
context.banner.hide('Hello World!', 'success', true);
```

### Parameters

| Prop      | Description                                            | Required | Value                           |
| --------- | ------------------------------------------------------ | -------- | ------------------------------- |
| autoclose | determine if the notification disappears automatically | optional | boolean *(default: false)*      |
| hasHeader | add padding if the header is visible                   | optional | boolean                         |
| text      | message text                                           | required | string                          |
| type      | banner type                                            | required | success, error or warning, info |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usegravity.app/gravity-native/components/notification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
