Ayushmaan Singh

Toast

Component 63

About

Here is Toast component

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Toast to your project and fits it to your theme.

Code

How Toast is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

import { ToastProvider, useToast } from '@/components/ui/toast-1';

function PageContent() {
  const { showToast } = useToast();

  return (
    <div className="flex flex-col justify-center items-center h-screen space-y-4">
      <button
        onClick={() => showToast('Operation successful.', 'success', 'top-right')}
        className="bg-neutral-100 hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-full"
      >
        Show Success Toast
      </button>

      <button
        onClick={() => showToast('There was an error.', 'error', 'bottom-left')}
        className="bg-neutral-100 hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-full"
      >
        Show Error Toast
      </button>

      <button
        onClick={() => showToast('Check this warning.', 'warning', 'top-left')}
        className="bg-neutral-100 hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-full"
      >
        Show Warning Toast
      </button>

      <button
        onClick={() => showToast('Here is some info.', 'info', 'bottom-right')}
        className="bg-neutral-100 hover:bg-opacity-90 text-black font-medium py-2 px-4 rounded-full"
      >
        Show Info Toast
      </button>
    </div>
  );
}

export default function Page() {
  return (
    <ToastProvider>
      <PageContent />
    </ToastProvider>
  );
}

Dependencies

More by Ayushmaan Singh

View all
  • Tubelight Navbar

    Tubelight Navbar

    3.6K
  • Theme Toggle

    Theme Toggle

    2.5K
  • Feature Section

    Feature Section

    1.7K
  • Vintage Keyboard

    Vintage Keyboard

    570
  • Thumbnail Carousel

    Thumbnail Carousel

    409
  • Typewriter Testimonial

    Typewriter Testimonial

    318
  • Image Fan Carousel

    Image Fan Carousel

    283
  • Testimonials

    Testimonials

    245