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

Notication

Notification box

Examples

Basic

Basic.

Placement

Control placement of Notication.

Async method

Async method.

Update

Update.

Hide close icon

Set hideClose to hide close icon。

Custom buttons

Custom buttons

Maximum number of Notications

Controls the number of Notications.

方法调用

直接通过方法调用。

Methods

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

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

The config type is as follows

PropertyDescriptionTypeDefaultRequire
contentprompt contentReactNode-true
descriptiondetail descriptionReactNode--
footercustom footer, such as buttonsReactNode--
durationDelay for automatic shutdown, in millisecond. Do not close automatically when set to 0number4500-
iconcustom iconReactNode--
closeIconCustom close iconReactNode--
hideCloseWhether to hide 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 and ConfigContext cannot be obtained through the context, so we also provide a method of manually setting

Notication.setGlobalConfig({
  themeProviderProps:  Omit<ThemeProviderProps, 'children'>,
  configProviderProps: Omit<ConfigProviderProps, 'children'>,
  container?: PortalContainerType<HTMLElement>;
  distance?: number;
  placement?: NoticationPlacement;
});

For details, please refer to ThemeProvider, ConfigProvider

Examples
Basic
Placement
Async method
Update
Hide close icon
Custom buttons
Maximum number of Notications
方法调用
Methods
setGlobalConfig
Copyright © 2020-2021 Rhys Xia