Alert

Alerts are used to communicate the status of a system, feature, or page. They indicate a specific state that may require attention from the user.
Installation
API Reference
This is an illustration of Alert component.
action
variant
<Alert mx="$2.5" action="info" variant="solid">
<AlertIcon as={InfoIcon} mr="$3" />
<AlertText>
We have updated our terms of service. Please review and accept to continue
using our service.
</AlertText>
</Alert>

Installation

Run the following command:

npx gluestack-ui add alert

API Reference

To use this component in your project, include the following import statement in your file.
import { Alert, AlertIcon, AlertText } from "@/components/ui/alert"
export default () => (
<Alert>
<AlertIcon />
<AlertText />
</Alert>
)

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Alert

Contains all alert related layout style props and actions. It inherits all the properties of React Native's View component.
Descendants Styling Props Props to style child components.
Sx Prop
Description
_text
Prop to style AlertText Component
_icon
Prop to style AlertIcon Component

AlertIcon

It inherits all the properties of React Native's View component.

AlertText

Contains all spinner related layout style props and actions. It inherits all the properties of React Native's Text component.

Props

Alert component is created using View component from react-native. It extends all the props supported by React Native View, utility props and the props mentioned below.

Alert

Name
Value
Default
action
error | warning | success | info | muted
info
variant
solid | outline | accent
solid

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

Alert with Heading

An example of an alert component with a heading, which further contains another alert component for displaying supplementary information.
<Alert action="success">
<AlertIcon as={CheckCircleIcon} size="xl" mr="$3" />
<VStack space="xs">
<AlertText fontWeight="$bold">Congratulations!</AlertText>
<AlertText>
Thank you for your submission. You will receive a confirmation email
shortly.
</AlertText>
</VStack>
</Alert>
Edit this page on GitHub