Skip to main content

Signature

toast.error(
  title: string,
  descriptionOrOptions?: string | ToastOptions,
  duration?: number
): void

Parameters

title
string
required
The toast title
descriptionOrOptions
string | ToastOptions
Description string OR options object with description, duration, icon, style, etc.
duration
number
Duration in milliseconds (default: 4000). Ignored if options object is passed as second parameter.

Toast options

When passing an options object as the second parameter, the following properties are available:
id
string
Stable key for deduplication. When set, toasts with the same id deduplicate and update the existing toast’s content.
description
string
Description text
duration
number
Duration in milliseconds (overrides default)
icon
ReactNode | IconRenderFn
Custom icon (ReactNode or render function)
style
ViewStyle
Style overrides for this toast’s container
titleStyle
TextStyle
Style overrides for this toast’s title
descriptionStyle
TextStyle
Style overrides for this toast’s description
dismissible
boolean
Whether this toast can be dismissed via swipe (overrides config)
showCloseButton
boolean
Whether to show the close button on this toast (overrides config)
deduplication
boolean
Enable deduplication for this toast (overrides global config). Plays a pulse animation for non-error toasts or a shake for errors.

Examples

Simple usage

toast.error("Failed", "Something went wrong");

With duration

toast.error("Failed", "Something went wrong", 6000);

With options object

toast.error("Failed", {
  description: "Something went wrong",
  duration: 6000,
  style: { borderRadius: 8 },
});

With custom icon

import { AlertCircle } from 'lucide-react-native';

toast.error("Failed", {
  description: "Unable to save changes",
  icon: <AlertCircle size={24} />,
});

Network error handling

try {
  await api.updateUser(data);
} catch (error) {
  toast.error("Update failed", {
    description: error.message,
    duration: 8000,
  });
}

Critical error with custom styling

toast.error("Critical Error", {
  description: "Please contact support",
  style: {
    borderWidth: 2,
    borderColor: '#dc2626',
  },
  titleStyle: {
    fontWeight: 'bold',
    fontSize: 16,
  },
  dismissible: false,
  duration: 10000,
});

Build docs developers (and LLMs) love