Applies to every preview on the site.
Installation
One command copies the source into your app — you own the code and can change anything.
After you add the file, import it like any local component:
import { Alert } from "@/components/ui/alert";Or add it with the CLI (installs any missing peers):
Usage
useKit(). Wrap your app in <KitProvider accent="#6366f1" radius={14}> to re-skin every component at once.Like this? There's a lot more in Pro Pro
12 full screens built from the same kit — install them the same way.
Props
| Prop | Type | Default |
|---|---|---|
| variant Tone and living icon. | "info" | "success" | "warning" | "danger" | "info" |
| appearance Card with a tone glow behind the icon, transparent with a hairline tone border, or filled with the solid tone. "accent-bar" is deprecated and renders as "soft". | "soft" | "outline" | "solid" | "accent-bar" | "soft" |
| title First line. Without a title (and without actions) the alert uses the compact single-line layout. | string | — |
| description Supporting text. | ReactNode | — |
| action One action: a tone pill under the text, or an inline pill on the right in the compact layout. | { label, onPress } | ReactNode | — |
| actions Pill pair on the bottom row; primary is filled with the tone. | { primary: { label, onPress }, secondary?: { label, onPress } } | — |
| icon Custom icon (shown in the halo) or none. | ReactNode | false | living tone icon |
| dismissible Show a 28pt close button (44pt hit area) that collapses the alert. | boolean | false |
| duration Auto-dismiss. A hairline drains along the bottom edge; pauses while pressed or hovered. | number (ms) | — |
| visible Controlled visibility (animated). | boolean | — |
| onDismiss Called when closed by the button or when `duration` runs out. | () => void | — |
| haptics Notification haptic (success / warning / error) when the alert appears. | boolean | false |
| color Override the tone colour. | string | tone colour |
| dismissLabel Screen-reader name of the dismiss button. Set it app-wide with KitProvider's labels. | string | labels.dismiss |
| style Style for the outer animated wrapper (its height collapses on dismiss). | StyleProp<ViewStyle> | — |
| className Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. | string | — |
Customization
You own the source file — tune appearance with props (no fork required for most tweaks). For brand-wide colours and radius, wrap your app in KitProvider; for one-off looks, use the style props below.
Design theme
Open Design theme on the live preview — accent, corner radius and font update every variant instantly (same as KitProvider in your app).
Variants
Pick the Variants chip above the preview, or set variant=… — "info" | "success" | "warning" | "danger".
Style props
React Native style and typed slots like fieldStyle, plus optional root className when you use NativeWind or Uniwind (cnProps from kit).
- variant
- "info" | "success" | "warning" | "danger" · default "info"Tone and living icon.
- color
- string · default tone colourOverride the tone colour.
- style
- StyleProp<ViewStyle>Style for the outer animated wrapper (its height collapses on dismiss).
- className
- stringTailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides.
Map tokens from your design system on Bring your design system or read Theming for KitProvider and NativeWind / Uniwind setup.
Behaviour & accessibility
- Motion
- On appear the icon outline draws, the glyph springs in and the halo ripples once. Dismissing collapses the height so content below glides up.
- Touch
- With duration set, a hairline drains along the bottom to show the time left. Pressing the alert pauses it.
- Reduced motion
- The icon draw, glyph pop and halo ripple jump straight to their finished state.
- Haptics
- Success, warning and danger alerts play the matching notification haptic when they appear; info stays silent.
- Screen readers
- The card has the alert role in a polite live region. The close button is labelled Dismiss and actions are buttons named by their label.
- Web
- Hovering also pauses the auto-dismiss timer.
Source
FAQ
How do I make an alert banner in React Native?
npx @expokit/cli@latest add alert in your Expo or React Native project and it copies a ready-made alert banner into your app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.Does Alert work in Expo Go?
react-native-svg, expo-haptics) are all included in Expo Go.How do I add Alert to my Expo app?
npx @expokit/cli@latest add alert in your project. The CLI copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change.Is Alert free?
Can I change how Alert looks?
useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.