@signalco/ui-notifications
v0.1.0
Published
## Getting started
Downloads
14
Readme
@signalco/ui-notifications
Getting started
Use NotificationsContainer
at the application root to provide notifications injection location.
'use client';
import { NotificationsContainer } from '@signalco/ui-notifications';
export function ClientProviders() {
return (
<>
{/* ...other provider components */}
<NotificationsContainer />
</>
)
}
Then you can use showNotification
hook to show notifications.
import { showNotification } from '@signalco/ui-notifications';
export function MyComponent() {
const handleAction = () => {
showNotification('Something went wrong.', 'error');
};
return (
<button onClick={handleAction}>Show notification</button>
);
}
Available functions
showNotification
showPrompt
hideNotification