import { Alert } from "@vortexlabs/vortex-native";
import { Hexagon } from "@vortexlabs/vortex-icons";
<Alert
tone="warning"
title="Download paused"
icon={Hexagon}
>
Connect to Wi-Fi to continue.
</Alert>Features
- Shows a message alongside the content it relates to.
- Supports seven tones, an optional icon, and action buttons.
- Supports temporary, controlled, and stored dismissal.
Tones
Choose a tone that matches the message. Use warning for something that needs attention and critical when an issue blocks the task.
import { Alert, Stack } from "@vortexlabs/vortex-native";
export const AlertTones = () => (
<Stack gap={3} width={360} maxWidth="100%">
<Alert tone="primary" title="New boarding pass">Add it to your wallet.</Alert>
<Alert tone="secondary" title="Trip suggestions">Explore places near your stay.</Alert>
<Alert tone="neutral" title="Travel documents">Keep your passport handy.</Alert>
<Alert tone="info" title="Gate changed">Board your flight at gate B12.</Alert>
<Alert tone="success" title="Check-in complete">Your boarding pass is ready.</Alert>
<Alert tone="warning" title="Boarding soon">Head to the gate in the next 10 minutes.</Alert>
<Alert tone="critical" title="Flight cancelled">Choose another flight to continue your trip.</Alert>
</Stack>
);Icons and Actions
Add an icon to reinforce the message and use actionsSlot for actions people can take from the alert.
import { Alert, Button, Stack } from "@vortexlabs/vortex-native";
import { CircleExclamation } from "@vortexlabs/vortex-icons";
import React from "react";
export const AlertActions = () => {
const [retrying, setRetrying] = React.useState(false);
return (
<Stack width={360} maxWidth="100%">
{retrying ? (
<Alert tone="info" title="Retrying download">Keep this screen open.</Alert>
) : (
<Alert
tone="warning"
title="Download paused"
icon={CircleExclamation}
actionsSlot={<Button onPress={() => setRetrying(true)}>Retry download</Button>}
>
The connection was interrupted.
</Alert>
)}
</Stack>
);
};Bleed
Set bleed to your container’s horizontal padding in 4-point units to extend the alert to the edges. A positive value removes the side borders and rounding.
import { Alert, Stack } from "@vortexlabs/vortex-native";
export const AlertBleed = () => (
<Stack padding={4} width={360} maxWidth="100%" gap={4} backgroundColor="surface">
<Alert tone="info" title="Check-in opens tomorrow" />
<Alert tone="info" title="Check-in opens tomorrow" bleed={4} />
</Stack>
);Dismissal
Pass dismissible to close the alert until it mounts again. Use persist: "custom" when the screen owns the dismissed state.
import { Alert, Button, Stack } from "@vortexlabs/vortex-native";
import React from "react";
export const AlertDismissal = () => {
const [dismissed, setDismissed] = React.useState(false);
return (
<Stack gap={3} width={360} maxWidth="100%">
<Alert
title="Offline maps are available"
tone="info"
dismissible={{ persist: "custom", dismissed, onClose: () => setDismissed(true) }}
closeAriaLabel="Dismiss offline maps tip"
>
Download a map before your trip.
</Alert>
<Button variant="secondary" disabled={!dismissed} onPress={() => setDismissed(false)}>
Show tip again
</Button>
</Stack>
);
};Persisted Dismissal
Pass a storage adapter such as AsyncStorage and a stable storageKey to remember dismissal across app launches. With async storage, the alert waits for the read to finish before appearing.
import { Alert, type AlertDismissalStorage } from "@vortexlabs/vortex-native";
type Props = {
storage: AlertDismissalStorage;
};
export const OfflineMapsTip = (props: Props) => {
const { storage } = props;
return (
<Alert
title="Offline maps are available"
tone="info"
dismissible={{ persist: storage, storageKey: "tips:offline-maps" }}
closeAriaLabel="Dismiss offline maps tip"
>
Download a map before your trip.
</Alert>
);
};Accessibility
announce={false} when the same message is already announced elsewhere.closeAriaLabel to identify the message when several alerts can be dismissed on the same screen.