Skip to content

Toast

<bh-toast> | BharatToast

The Toast component provides non-intrusive, auto-dismissed alert messages with support for different types, custom message, and positions.


Open in flex-shrink: 0; flex-shrink: 0;

Show Success Toast

Show Warning ToastShow Warning ToastShow Warning Toast

Basic Usage


Show Toast Programmatically

import { showToast } from 'path/to/toast.js';
showToast({
message: 'Success! Your action completed.',
type: 'success',
position: 'bottom-left',
duration: 3000
});

Variants

Types

Open in flex-shrink: 0; flex-shrink: 0;

Show Success Toast

Show Error ToastShow Warning ToastShow Information Toast

Outline

Open in flex-shrink: 0; flex-shrink: 0;

Show Success Toast

Show Error ToastShow Warning ToastShow Info Toast

Positions

The options available to position the toast notification are ‘top-left’, ‘top-center’, ‘top-right’, ‘bottom-left’, ‘bottom-center’, ‘bottom-right’

Open in flex-shrink: 0; flex-shrink: 0;

Show Success Toast

Show Info Toast

Properties

PropertyTypeDescription
messagestringToast message content
variantstringOne of info, success, warning, error
positionstringPredefined or "custom-position"

Methods

MethodDescription
showToast(options)Function call to display the dialog, takes options object as a parameter. e.g - { message:"Show toast", variant:"primary",position:"bottom-right"}