Skip to Content
DocumentationToast

Toast

A temporary notification component used to display feedback messages to the user.

Setup

Add the Toaster component to your root layout or a central component in your application.

layout.tsx
import { Toaster } from "@medway-ui/core"; export default function RootLayout({ children }) { return ( <html lang="en"> <body> <main>{children}</main> <Toaster /> </body> </html> ); }

Examples

Primary

Secondary

Success

Warning

Error

With Action

Without Icon

Without Description

API

Toast

PropertyTypePossible valuesDefaultDescription
variant”primary” | “secondary” | “success” | “warning” | “error""primary”, “secondary”, “success”, “warning”, “error""primary”Sets the visual style of the toast.
showIconbooleantrue, falsetrueShows or hides the icon based on the variant.
durationnumber-5000Duration in milliseconds before the toast auto-closes.
classNamestring--Additional CSS classes for customization.

ToastAction

PropertyTypePossible valuesDefaultDescription
variant”primary” | “secondary” | “success” | “warning” | “error""primary”, “secondary”, “success”, “warning”, “error""primary”Sets the visual style of the action button.
altTextstring-”Toast action”Alternative text for accessibility.
classNamestring--Additional CSS classes for customization.

ToastClose

PropertyTypePossible valuesDefaultDescription
labelstring-”Close”Accessible label for the close button.
classNamestring--Additional CSS classes for customization.
Last updated on