This is the pre-release documentation for gluestack-ui with NativeWind (alpha) version. For @gluestack-ui/themed(stable) documentation, refer to the latest release (v1).
This is an illustration of Alert component.
action
variant
<Alert className="mx-2.5" action="info" variant="solid">
<AlertIcon as={InfoIcon} className="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.

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.

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" className="mr-3" />
<VStack space="xs">
<AlertText className="font-bold">Congratulations!</AlertText>
<AlertText>
Thank you for your submission. You will receive a confirmation email
shortly.
</AlertText>
</VStack>
</Alert>