Toast

Brief feedback with sonner's API: a type, a description, an action and a close button.

import { Toaster, toast } from "@plexui/react-native"

Examples

Overview

Platforms

iOS 26Android
Native componentNone (a Plex banner; iOS has no system toast)None (a Plex view drawn as a dark card)
LookGlass banner from the topA dark card with 16dp corners at the bottom

Neither platform's system toast is used: on Android the toast is a view of the app, not Material's Snackbar.

API

toast

PropTypeDefaultDescription
toast(title: ReactNode, options?: ToastOptions) => ToastId—Shows a toast and returns its id
toast.success(title: ReactNode, options?: ToastOptions) => ToastId—A success toast
toast.error(title: ReactNode, options?: ToastOptions) => ToastId—An error toast
toast.warning(title: ReactNode, options?: ToastOptions) => ToastId—A warning toast
toast.info(title: ReactNode, options?: ToastOptions) => ToastId—An info toast
toast.dismiss(id?: ToastId) => void—Closes one toast, or every toast without an id

ToastOptions

PropTypeDefaultDescription
idstring | number—The toast's id; a toast with the same id is updated in place and its time starts again
descriptionReactNode—A second line under the title
action{ label: string; onClick: () => void }—One action, as sonner's; it closes the toast after its onClick
durationnumber4000; 2750 on Android, 5000 with an actionMilliseconds on screen; Infinity stays until it is dismissed
iconReactNode—A symbol of its own before the title; false or null leaves the type's out
closeButtonboolean—A close button: a close icon at the end of the card on Android. iOS ignores it
closeButtonAriaLabelstring"Close toast"Accessible name of the close button
onDismiss() => void—Called when the toast is dismissed

Toaster

PropTypeDefaultDescription
visibleToastsnumber3How many toasts stand at once on iOS; on Android a new toast replaces the one shown
bottomOffsetnumber0Android: the height of a bar at the bottom (a TabBar, a bottom Toolbar, from the screen's edge) that the toast stands 8dp above
topOffsetnumber0iOS: the height of a bar at the top (a Toolbar, from the screen's edge, its safe area included) that the banners stand 16 under, so the bar's back button and title stay readable
testIDstring—Test id