Skip to content

Alert

Text Component

Demo


A notification to capture user attention.

Installation

Terminal window
npx @react-native-reusables/cli@latest add alert

Usage

import { Alert, AlertDescription, AlertTitle } from '~/components/ui/alert';
import { AlertTriangle } from '~/lib/icons/AlertTriangle';
import { Terminal } from '~/lib/icons/Terminal';
function AlertExample() {
return (
<Alert icon={Terminal} className='max-w-xl'>
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>
You can use a terminal to run commands on your computer.
</AlertDescription>
</Alert>
<Alert icon={AlertTriangle} variant='destructive' className='max-w-xl'>
<AlertTitle>Danger!</AlertTitle>
<AlertDescription>
High voltage. Do not touch. Risk of electric shock. Keep away from children.
</AlertDescription>
</Alert>
);
}

Props

Alert

Extends View props

PropTypeNote
variant"default" | "destructive"(optional)
iconLucideIcon(required)
iconSizenumber(optional, default: 16)
iconClassNamestring(optional)

AlertTitle

Extends Text props

PropTypeNote
asChildboolean(optional)

AlertDescription

Extends Text props

PropTypeNote
asChildboolean(optional)