Looking for documentation on gluestack-ui v2 with NativeWind? Refer to this link.
This is an illustration of a Themed Alert component with default configuration.
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>

API Reference

Import

To use this component in your project, include the following import statement in your file.
import { Alert, AlertIcon, AlertText } from "@gluestack-ui/themed"

Anatomy

The structure provided below can help you identify and understand a Alert component's various parts.
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.

Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this link.

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>

Unstyled

All the components in gluestack-ui are unstyled by default. To customize your UI using the extendedTheme, please refer to this link. The import names of components serve as keys to customize each component.

Spec Doc

Explore the comprehensive details of the Alert in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.