Alert

Display modal alert dialogs with customizable content, icons, and dismiss behavior.

Alert component provides a way to display modal dialogs to users with a title, message, and optional custom content. Perfect for confirmations, warnings, or important notifications.

Interactive Preview
9:41

Props#

PropTypeDefaultRequiredDescription
visiblebooleanControls alert visibility
onClose() => voidCallback when alert is closed
titlestringAlert title text
messagestringAlert message text
iconReactNodeOptional icon displayed above title
childrenReactNodeCustom content (overrides message)
dismissOnBackdropPressbooleantrueDismiss when tapping overlay
borderRadiusnumber16Alert box border radius
backgroundColorstring#FFFFFFAlert background color
overlayColorstringrgba(0,0,0,0.5)Overlay/backdrop color
shadowColorstringCustom shadow/elevation color
titleColorstringOverride title text color
messageColorstringOverride message text color
styleViewStyleAlert box container styles
titleStyleTextStyleTitle text styles
messageStyleTextStyleMessage text styles
overlayStyleViewStyleOverlay styles
iconContainerStyleViewStyleIcon wrapper styles
contentContainerStyleViewStyleChildren wrapper styles

Examples#

With Custom Content#

<Alert
  visible={visible}
  onClose={() => setVisible(false)}
  title="Custom Alert"
>
  <View style={{ padding: 16 }}>
    <Text>This is custom content</Text>
    <Button
      title="Confirm"
      onPress={() => setVisible(false)}
      variant="filled"
    />
  </View>
</Alert>

With Icon#

import { InfoIcon } from 'lucide-react-native'

<Alert
  visible={visible}
  onClose={() => setVisible(false)}
  title="Information"
  message="This is an informational alert"
  icon={<InfoIcon size={32} color="#6366F1" />}
/>

With Custom Styling#

<Alert
  visible={visible}
  onClose={() => setVisible(false)}
  title="Styled Alert"
  message="Custom styled alert"
  borderRadius={24}
  backgroundColor="#F3F4F6"
  titleStyle={{ fontSize: 20, fontWeight: 'bold', color: '#000' }}
  messageStyle={{ fontSize: 14, color: '#666' }}
/>