xl vision
  • Component
  • React Hooks
  • Playground
  • Overview
  • Color
  • Getting Start
    • Installation
  • General
    • Icon
    • Button
  • Layout
    • Grid
  • Form
    • Input
    • InputNumber
    • Textarea
  • Navigation
    • Dropdown
    • Affix
    • BackTop
    • Anchor
  • Data Display
    • Tooltip
    • Popover
    • Avatar
  • Faceback
    • Popconfirm
    • Dialog
    • Message
    • Notication
  • Animation
    • Transition
    • TransitionGroup
    • CollapseTransition
    • Ripple
  • Styles
    • Theme
    • CssBaseline
  • Basic Component
    • BaseButton
    • Portal
    • Popper
    • Modal
    • ResizeObserver

Message

Display global messages as feedback in response to user operations.

Examples

Basic

Basic.

Async function

Async function.

Update

Update.

Show close icon

duration is set to 0 to keep Message not closed, then you need to set showClose to display the close button and close it manually.

Maximum number of Messages

Controls the number of Messages.

Method call

Directly through the method call.

Methods

The component provides some static methods, the usage and parameters are as follows:

  • Message.success(config | string)
  • Message.error(config | string)
  • Message.info(config | string)
  • Message.warning(config | string)
  • Message.loading(config | string)
  • Message.open(config | string)

The config type is as follows

PropertyDescriptionTypeDefaultRequire
contentprompt contentReactNode-true
durationDelay for automatic shutdown, in millisecond. Do not close automatically when set to 0number3000-
iconcustom iconReactNode--
closeIconCustom close iconReactNode--
showCloseWhether to show the close iconboolean--
onAfterClosedcallback after Message is closed() => void--

In addition to the above parameters, it also supports basic HTMLAttributes, such as className, style.

setGlobalConfig

For the global method, ThemeContext cannot be obtained through the context, so we also provide a method of manually setting

Message.setGlobalConfig({
  themeProviderProps:  Omit<ThemeProviderProps, 'children'>,
  top?: number;
  container?: PortalContainerType<HTMLElement>;
});

For details, please refer to ThemeProvider.

Examples
Basic
Async function
Update
Show close icon
Maximum number of Messages
Method call
Methods
setGlobalConfig
Copyright © 2020-2021 Rhys Xia