Notification
Notifications inform or alert users about important events.
Examples
import React from 'react';
import ReactDOM from 'react-dom';
import { Notification, NotificationCenter, Button } from 'furl-components';
const notificationCenterRef = React.createRef();
ReactDOM.render(
<div>
<NotificationCenter
ref={notificationCenterRef}
verticalPosition='top'
horizontalPosition='right'
/>
<Button onClick={() => notificationCenterRef.current.addNotification(
<Notification color='primary' size='large' textAlign='left'>
This is an important notification.
</Notification>
)}>Add notification
</Button>
</div>,
document.getElementById('root')
);API
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| ref | notification center ref | React Ref | |||
| verticalPosition | notification center vertical position | string | 'bottom' | ||
| horizontalPosition | notification center horizontal position | string | 'right' | ||
| Method | Description | ||
|---|---|---|---|
| addNotification() | add a notification to the notification center | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| color | notification color | string | 'plain' | ||
| size | notification size | string | 'normal' | ||
| textAlign | notification text alignment | string | 'center' | ||
Notes
- It is highly recommended to provide a
reffor yourNotificationCentervia the use ofReact.createRef().NotificationCentershould only be used once in your app and it should be reused viaref.currentfor multiple modal dialogs. - A
NotificationCenteronly accepts children of theNotificationcomponent type, set either normally or via theaddNotificationmethod. verticalPositioncan be one of the following:'top','centerr'or'bottom'.horizontalPositioncan be one of the following:'left','center'or'right'.colorcan be any of the predefined color palettes ('plain','primary','secondary','success','warning'or'danger').sizecan be one of the following:'small','normal'or'large'.textAligncan be one of the following:'left','center'or'right'.
