# @trendmicro/react-notifications

> Trend Micro Components: React Notifications

Latest version **1.0.1** (published 2018-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @trendmicro/react-notifications
pnpm add @trendmicro/react-notifications
yarn add @trendmicro/react-notifications
bun add @trendmicro/react-notifications
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-04-18 |
| First published | 2017-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 54.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Cheton Wu |
| Maintainers | cheton, rothpeng, trendmicro-frontend, xjkit |
| Keywords | react, react-notifications |

## Links

- npm: https://www.npmjs.com/package/@trendmicro/react-notifications
- Repository: https://github.com/trendmicro-frontend/react-notifications
- Issues: https://github.com/trendmicro-frontend/react-notifications/issues
- npm.io page: https://npm.io/package/@trendmicro/react-notifications

## Dependencies (2)

- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-04-18
- 1.0.0 — 2017-12-11
- 0.2.3 — 2017-11-17
- 0.2.2 — 2017-10-06
- 0.2.1 — 2017-06-23
- 0.2.0 — 2017-06-20

## README

# react-notifications [![build status](https://travis-ci.org/trendmicro-frontend/react-notifications.svg?branch=master)](https://travis-ci.org/trendmicro-frontend/react-notifications) [![Coverage Status](https://coveralls.io/repos/github/trendmicro-frontend/react-notifications/badge.svg?branch=master)](https://coveralls.io/github/trendmicro-frontend/react-notifications?branch=master)

[![NPM](https://nodei.co/npm/@trendmicro/react-notifications.png?downloads=true&stars=true)](https://nodei.co/npm/@trendmicro/react-notifications/)

React Notifications

Demo: https://trendmicro-frontend.github.io/react-notifications

## Installation

1. Install the latest version of [react](https://github.com/facebook/react) and [react-notifications](https://github.com/trendmicro-frontend/react-notifications):

  ```
  npm install --save react @trendmicro/react-notifications
  ```

2. At this point you can import `@trendmicro/react-notifications` and its styles in your application as follows:

  ```js
  import { Notification, ToastNotification } from '@trendmicro/react-notifications';

  // Be sure to include styles at some point, probably during your bootstraping
  import '@trendmicro/react-notifications/dist/react-notifications.css';
  ```

## Usage

### Notification

#### Controlled Notification

```js
const { dismissed } = this.state;

<Notification
    show={!dismissed}
    type="error"
    onDismiss={event => {
        this.setState({ dismissed: true });
    }}
/>
```

#### Uncontrolled Notification

Note: Always pass a new key while re-rendering uncontrolled notifications.

```js
<Notification
    key={_.uniqueId()}
    type="error"
    onDismiss={event => { // Optional
        // Generate a new key if the notification is dismissed.
    }}
/>
```

### Toast Notification

#### Controlled Toast Notification

```js
const { dismissed } = this.state;

<ToastNotification
    show={!dismissed}
    type="warning"
    autoDismiss={5000}
    onDismiss={event => {
        this.setState({ dismissed: true });
    }}
/>
```

#### Uncontrolled Toast Notification

Note: Always pass a new key while re-rendering uncontrolled toast notifications.

```js
<ToastNotification
    key={_.uniqueId()}
    type="warning"
    autoDismiss={5000}
    onDismiss={event => { // Optional
        // Generate a new key if the toast notification is dismissed.
    }}
/>
```

## API

### Properties

Name        | Type     | Default | Description 
:---------- | :--------| :------ | :----------
type        | String   | ''      | One of: 'error', 'warning', 'info', 'success'
show        | Boolean  | true    | Whether or not the component is visible.
dismissible | Boolean  | true    | Whether or not the notification is dismissible.
autoDismiss | Number or Boolean  | false | The auto dismiss timeout in milliseconds.
onDismiss   | Function |         | A callback fired when the dismiss icon (x) is clicked.

## License

MIT

---
_Source: https://npm.io/package/@trendmicro/react-notifications · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
