# @uiw/react-message

> Message component

Latest version **4.22.3** (published 2023-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @uiw/react-message
pnpm add @uiw/react-message
yarn add @uiw/react-message
bun add @uiw/react-message
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.22.3 |
| Published | 2023-11-29 |
| First published | 2020-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 33.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 740 |
| Author | Kenny Wong |
| Maintainers | uiwjs, wcjiang |
| Keywords | message, react-message, design, uiw, uiw-react, react.js, react, react-component, component, components, ui, css, uikit, react-ui, framework, front-end, frontend |

## Links

- npm: https://www.npmjs.com/package/@uiw/react-message
- Repository: https://github.com/uiwjs/uiw
- Homepage: https://uiwjs.github.io/#/components/message
- Issues: https://github.com/uiwjs/uiw/issues
- Funding: https://jaywcjlove.github.io/#/sponsor
- npm.io page: https://npm.io/package/@uiw/react-message

## Dependencies (4)

- [@uiw/utils](https://npm.io/package/@uiw/utils.md) ^4.22.3
- [@uiw/react-icon](https://npm.io/package/@uiw/react-icon.md) ^4.22.3
- [@uiw/react-button](https://npm.io/package/@uiw/react-button.md) ^4.22.3
- [react-transition-group](https://npm.io/package/react-transition-group.md) ~4.4.2

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 4.22.3 (latest) — 2023-11-29
- 5.0.0-bate.2.1 (bate) — 2023-03-10
- 4.22.2 — 2023-11-09
- 4.22.1 — 2023-11-08
- 4.22.0 — 2023-09-19
- 4.21.28 — 2023-05-05
- 4.21.27 — 2023-04-21
- 4.21.26 — 2023-04-20
- 4.21.25 — 2023-03-14
- 4.21.24 — 2023-03-08
- 5.0.0-bate.2.0 — 2023-03-02
- 4.21.23 — 2022-12-21
- 4.21.22 — 2022-12-19
- 4.21.21 — 2022-12-19
- 5.0.0-bate-19 — 2022-12-12
- … 157 more at https://npm.io/package/@uiw/react-message/versions

## README

Message 警告提示
===

[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-message/file/README.md)
[![NPM Downloads](https://img.shields.io/npm/dm/@uiw/react-message.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-message)
[![npm version](https://img.shields.io/npm/v/@uiw/react-message.svg?label=@uiw/react-message)](https://npmjs.com/@uiw/react-message)

警告提示，用于页面中展示重要的提示信息。

```jsx
import { Message } from 'uiw';
// or
import Message from '@uiw/react-message';
```

### 基础用法

```jsx mdx:preview&bg=#fff
import React from 'react';
import { Message, Divider } from 'uiw';

class Demo extends React.Component {
  render() {
    return (
      <div>
        <Message type="success" title="成功提示标题" description="这里是成功提示详情描述。" />
        <Message
          type="warning"
          title={<div>警告提示标题</div>}
          description="这里是警告提示详情描述。"
        />
        <Message type="info" title="说明提示标题" description="这里是说明提示详情描述。" />
        <Message type="error" title="错误提示标题" description="这里是错误提示详情描述。" />

        <Divider />
        <Message type="success" title="成功提示标题" />
        <Message type="warning" title="警告提示标题" />
        <Message type="info" title="说明提示标题" />
        <Message type="error" title="错误提示标题" />
      </div>
    )
  }
}
export default Demo;
```

### 显示图标

```jsx mdx:preview&bg=#fff
import React from 'react';
import { Message, Divider } from 'uiw';

export default function Demo() {
  return (
    <div>
      <Message showIcon type="success" title="成功提示标题" />
      <Message showIcon type="warning" title="警告提示标题" />
      <Message showIcon type="info" title="说明提示标题" />
      <Message showIcon type="error" title="错误提示标题" />
      <Divider />
      <Message showIcon type="success" description="这里是成功提示详情描述。" />
      <Message showIcon type="warning" description="这里是警告提示详情描述。这里并没有设置 title，只设置 description 同时设置显示图标。" />
      <Message showIcon type="info" description="这里是说明提示详情描述。" />
      <Message showIcon type="error" description="这里是错误提示详情描述。" />
      <Divider />
      <Message showIcon type="success" title="成功提示标题" description="这里是成功提示详情描述。" />
      <Message
        showIcon
        type="warning"
        title="警告提示标题"
      >
        这里是警告提示详情描述。
      </Message>
      <Message showIcon type="info" title="说明提示标题" description="这里是说明提示详情描述。" />
      <Message showIcon type="error" title="错误提示标题" description="这里是错误提示详情描述。" />
    </div>
  )
}
```

### 自定义图标

```jsx mdx:preview&bg=#fff
import React from 'react';
import { Message, Divider } from 'uiw';

const chat = ( <svg width="20" height="20" viewBox="0 0 20 20"> <path d="M19 0H7c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h5.59l3.71 3.71c.17.18.42.29.7.29.55 0 1-.45 1-1v-3h1c.55 0 1-.45 1-1V1c0-.55-.45-1-1-1zM7 13c-1.1 0-2-.9-2-2V4H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h1v3a1.003 1.003 0 0 0 1.71.71L7.41 16H13c.55 0 1-.45 1-1v-.17L12.17 13H7z" fillRule="evenodd" /> </svg> );
const closed = <svg viewBox="0 0 16 16" width="16" height="16"> <path fillRule="evenodd" d="M7 10h2v2H7v-2zm2-6H7v5h2V4zm1.5 1.5l-1 1L12 9l4-4.5-1-1L12 7l-1.5-1.5zM8 13.7A5.71 5.71 0 0 1 2.3 8c0-3.14 2.56-5.7 5.7-5.7 1.83 0 3.45.88 4.5 2.2l.92-.92A6.947 6.947 0 0 0 8 1C4.14 1 1 4.14 1 8s3.14 7 7 7 7-3.14 7-7l-1.52 1.52c-.66 2.41-2.86 4.19-5.48 4.19v-.01z" /> </svg>;
class Demo extends React.Component {
  render() {
    return (
      <div>
        <Message showIcon icon="apple" type="error" title="自定义图标" description="这里自定义Icon组件图标。" />
        <Message showIcon icon={chat} type="info" title="自定义图标" description="这里自定义 SVG 图标。" />
        <Message showIcon icon={closed} type="success" title="自定义图标" description="这里自定义 SVG 图标。" />
        <Divider />
        <Message showIcon icon={chat} type="success" title="成功提示标题，自定义图标。" />
        <Message showIcon icon={closed} type="warning" title="警告提示标题，自定义图标。" />
        <Message showIcon icon="apple" type="info" title="说明提示标题，自定义图标。" />
        <Message showIcon icon="file-jpg" type="error" title="错误提示标题，自定义图标。" />
      </div>
    )
  }
}
export default Demo;
```

### 关闭按钮

```jsx mdx:preview&bg=#fff
import React from 'react';
import { Message, Divider } from 'uiw';

class Demo extends React.Component {
  render() {
    return (
      <div>
        <Message
          showIcon
          isCloseButtonShown
          type="success"
          title="自定义图标"
          description="这里设置参数 isCloseButtonShown 显示关闭按钮。这里设置 title 和 description 同时设置显示图标。"
        />
        <Divider />
        <Message showIcon isCloseButtonShown type="info" title="说明提示标题，自定义图标。" />
        <Message isCloseButtonShown type="error" title="错误提示标题，自定义图标。" />
      </div>
    )
  }
}
export default Demo;
```

## Props

| 参数 | 说明 | 类型 | 默认值 |
|--------- |-------- |--------- |-------- |
| type | 指定警告提示的样式 | Enum{`success`, `warning`, `info`, `error`} | - |
| title | 警告提示标题 | String/ReactNode | - |
| description | 警告提示描述详情 | String/ReactNode | - |
| rounded | 是否显示圆角 | Boolean | - |
| showIcon | 设定显示图标 | Boolean | - |
| isCloseButtonShown | 显示关闭按钮 | Boolean | - |
| icon | 自定义图标，设置 `showIcon=true` 才会起作用。 | String/ReactNode | - |
| onClose | 点击默认关闭按钮时触发的回调函数	 | Function | - |

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