Toast

A notification component for displaying temporary messages.

import { toast, Toaster, Button } from "ui-lab-components";
 
export function Example() {
  return (
    <>
      <Button onClick={() => toast({ title: 'Notification', description: 'This is a toast message' })}>
        Show Toast
      </Button>
      <Toaster />
    </>
  );
}

Basic Toast

A simple toast notification. Click the button to trigger a toast message with default styling.

import React from 'react';
import { Button, toast, Toaster } from 'ui-lab-components';
 
export default function Example() {
  return (
    <>
      <Button
        size="sm"
        onClick={() => toast({ title: 'Notification', description: 'This is a toast message' })}>
        Show Toast
      </Button>
      <Toaster />
    </>
  );
}

Success Toast

Toast notification for successful operations.

import React from 'react';
import { Button, toast, Toaster } from 'ui-lab-components';
 
export default function Example() {
  return (
    <>
      <Button
        size="sm"
        onClick={() =>
          toast({
            title: 'Success',
            description: 'Operation completed successfully',
            variant: 'success',
          })
        }
      >
        Show Success
      </Button>
      <Toaster />
    </>
  );
}

Danger Toast

Toast notification for errors or destructive operations.

import React from 'react';
import { Button, toast, Toaster } from 'ui-lab-components';
 
export default function Example() {
  return (
    <>
      <Button
        size="sm"
        onClick={() =>
          toast({
            title: 'Error',
            description: 'Something went wrong',
            variant: 'danger',
          })
        }
      >
        Show Error
      </Button>
      <Toaster />
    </>
  );
}

Info Toast

Toast notification for informational messages.

import React from 'react';
import { Button, toast, Toaster } from 'ui-lab-components';
 
export default function Example() {
  return (
    <>
      <Button
        size="sm"
        onClick={() =>
          toast({
            title: 'Info',
            description: 'Here is some useful information',
            variant: 'info',
          })
        }
      >
        Show Info
      </Button>
      <Toaster />
    </>
  );
}

Warning Toast

Toast notification for warnings.

import React from 'react';
import { Button, toast, Toaster } from 'ui-lab-components';
 
export default function Example() {
  return (
    <>
      <Button
        size="sm"
        onClick={() =>
          toast({
            title: 'Warning',
            description: 'Please be careful',
            variant: 'warning',
          })
        }
      >
        Show Warning
      </Button>
      <Toaster />
    </>
  );
}
UI Lab