gluestack-ui logopreview
Docs
Blog
Get Updates
Prompt to React Native
IntroductionQuick Start
InstallationTooling SetupVS Code ExtensionsFigma UI KitCLIgluestack-ui-nativewind-utils
AccessibilityUniversal
Benchmarks
Default TokensCustomizing ThemeDark Mode
All Components
HeadingrscTextrsc
BoxrscCenterrscDividerHStackrscVStackrscGridalpha, rsc
AlertProgressSpinnerToast
BadgeCardrscTablealphaTabsalpha
ButtonCheckboxDateTimePickerCalendarFormControlInputLinkPressableRadioSelectSliderSwitchTextarea
AlertDialogDrawerLiquid GlassMenuModalPopoverPortalTooltipImage Viewer
ActionsheetAccordionBottomSheetalpha
AvatarImageIconrsc
FabSkeletonalpha, rsc
useBreakPointValueuseMediaQuery
Dashboard AppKitchensink AppTodo AppStarter KitAppLighter
LinearGradient
Building Ecommerce App
Upgrade to v2Upgrade to v3Upgrade to v4FAQsReleasesChangelogRoadmapTroubleshootingDiscord FAQs

Toast

gluestack-ui Toast component for React Native lets you show toast messages effortlessly. Improve your Toast component with flexible placement, duration, and actions. This is an illustration of Toast component.
action
variant

Installation

Run the following command:

npx gluestack-ui@alpha add toast

API Reference

To use this component in your project, include the following import statement in your file.
import { useToast, Toast } from '@/components/ui/toast';
anatomy-imageanatomy-image
export default () => (
  <Toast>
    <ToastTitle />
    <ToastDescription />
  </Toast>
);

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Toast

It inherits all the properties of React Native's
View
component.
PropTypeDefaultDescription
duration
number or null5000The delay before the toast hides (in milliseconds). If set to null, toast will never dismiss.
onCloseComplete
()=>-Callback function to run side effects after the toast has closed.
placement
'top'| 'top right' | 'top left' | 'bottom' | 'bottom left' | 'bottom right'bottomPosition of toast on the web page.
render?: (props: any)
ReactNode-Renders a toast component
avoidKeyboard
boolfalseIf true and the keyboard is opened, the Toast will move up equivalent to the keyboard height.
containerStyle
ViewStyle-Container style object for the toast.

ToastTitle

Contains all Text related layout style props and actions. It inherits all the properties of React Native's
Text
component.

ToastDescription

Contains all Text related layout style props and actions. It inherits all the properties of React Native's
Text
component.

Accessibility

We have outlined the various features that ensure the Toast component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards.Adheres to the
WAI-ARIA design pattern
.

Keyboard

  • Tab + Enter
    : Triggers the toast's action.

Screen Reader

  • VoiceOver: When the toast is focused, the screen reader will announce the toast's title.

Props

Toast component is created using View component from react-native. It extends all the props supported by
React Native View
and the props mentioned below.

Toast

NameValueDefault
action
error | warning | success | info | muted
muted
variant
solid | outline
solid

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

Toast in note talking platform

Social media notification

Software update toast

Message sent toast

Edit this page on GitHub
Go backSpinner
Up nextBadge
Go backSpinner
Up nextBadge