A premium alert library for React. Smooth, fluid modals with liquid glass effects and GSAP-powered transitions. Elevate your UI with the transparency it deserves.
Smooth entrance with liquid easing.
Bounce animation with shake icons.
Non-blocking with timer progress.
Ultra-glass effect with custom colors.
Interactive result handling.
Smooth directional transitions.
Custom background and amber buttons.
Opaque background for maximum readability.
Get started with a single command:
npm install glass-alert-animation gsap lottie-react
1. Setup the Provider
Wrap your application with the GlassAlertProvider and import the styles.
import { GlassAlertProvider } from 'glass-alert-animation';
import 'glass-alert-animation/styles';
function App() {
return (
<GlassAlertProvider>
<yourApp />
</GlassAlertProvider>
);
}
2. Trigger an Alert
Use the useGlassAlert hook to fire alerts anywhere in your components.
import { useGlassAlert } from 'glass-alert-animation';
function MyComponent() {
const { fire } = useGlassAlert();
const handleAlert = async () => {
const result = await fire({
title: 'Success!',
text: 'GlassAlert is working perfectly.',
icon: 'success',
glassColor: '#6366f1',
animation: 'liquid'
});
if (result.isConfirmed) {
console.log('User clicked OK');
}
};
return <button onClick={handleAlert}>Show Alert</button>;
}
Basic Success Alert
fire({
title: 'Success!',
text: 'The operation was completed.',
icon: 'success',
animation: 'elastic'
});
Toast Notification
fire({
title: 'New Message',
toast: true,
position: 'top-end',
timer: 3000,
timerProgressBar: true
});
Confirm Dialog
const result = await fire({
title: 'Are you sure?',
text: 'You cannot undo this!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, delete it'
});
if (result.isConfirmed) {
// Logic here
}
Custom Lottie Icon
Pass a URL or an imported JSON object to use your own animations.
fire({
title: 'Custom Animation',
lottie: 'https://assets9.lottiefiles.com/packages/lf20_afwjh8re.json',
lottieLoop: true
});
Designed for modern tech brands. Luminous borders, frosted glass, and interactive glows.
No clunky CSS transitions. We use GSAP for sub-pixel precision and fluid motion.
Beautiful, fluid animated icons for every alert type powered by Lottie.
Control blur intensity, colors, backgrounds, and more to match your brand exactly.
Easy-to-use hooks and providers designed specifically for the React ecosystem.
Optimized for mobile, tablet, and desktop. Looks stunning on any screen size.
| Option | Type | Default |
|---|---|---|
title |
string | '' |
icon |
success | error | warning | info | question | undefined |
animation |
elastic | bounce | slide | fade | liquid | 'elastic' |
glassBlur |
number (px) | 20 |
toast |
boolean | false |
glassColor |
string | '#6366f1' |
glassColorSecondary |
string | '#8b5cf6' |
confirmButtonColor |
string | '#6366f1' |
cancelButtonColor |
string | '#ffffff' |
timer |
number (ms) | 0 |
isOpaque |
boolean | false |
lottie |
string | object | undefined |
lottieLoop |
boolean | false |
useLottieIcons |
boolean | true |