1.0.2 • Published 1 year ago

web-notification-react v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

WebNotification Component

The WebNotification component is a React functional component that allows you to display web notifications with customizable options.

Installation

To use the WebNotification component, you can include it in your project files directly or install it as a package if you plan to distribute it. For direct use, ensure you have React and ReactDOM installed in your project.

Usage

Import the Component

First, import the WebNotification component in your React file:

import React from 'react';
import ReactDOM from 'react-dom';
import { WebNotification } from './path/to/WebNotification';

const App = () => {
    const handleNotificationClick = () => {
        alert('Notification clicked!');
    };

    return (
        <div>
            <h1>Testing WebNotification Component</h1>
            <WebNotification
                title='Falkon SMS'
                icon='path/to/icon.png'
                body='This is the body of the notification'
                timeout={10000}
                ignore={false}
                onClickFn={handleNotificationClick}
            />
        </div>
    );
};

ReactDOM.render(<App />, document.getElementById('app'));
PropTypeRequiredDefaultDescription
titlestringYesThe title of the notification.
iconstringNoURL of an icon to be displayed in the notification.
bodystringNoThe body text of the notification.
timeoutnumberNo5000Duration (in milliseconds) before the notification automatically closes.
ignorebooleanYesIf true, the notification will not be shown.
onClickFnfunctionNoFunction to be called when the notification is clicked.
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago