Components

Toast

Toast

Display non-intrusive notifications or messages to users.

Simple

Successfully liked!

John Doe has been notified.

Use toasts to deliver real-time updates to a user without disrupting their flow.

Options

  • triggerOnLoad(data-railsui-toast-trigger-on-load-value="true"): Make the toast notification appear as soon as initialized. Defaults to false.

CSS

Toasts typically enter the screen from the left or right side of the viewport. This example accounts for those two variants by extending your Tailwind Theme variables to include new animation-based CSS variables.

/* Add to app/assets/stylesheets/railsui/theme.css */

--animate-toast-from-right: toast-from-right 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
--animate-toast-from-left: toast-from-left 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);

@keyframes toast-from-right {
  0% {
    transform: translateX(50%);
    opacity: 0%;
  }

  100% {
    transform: translateX(0);
    opacity: 100%;
  }
}

@keyframes toast-from-left {
  0% {
    transform: translateX(-50%);
    opacity: 0%;
  }

  100% {
    transform: translateX(0);
    opacity: 100%;
  }
}

On this page