Skip to main content

Message

Display global messages as feedback in response to user operations.

When To Use#

  • To provide feedback such as success, warning, error etc.
  • A message is displayed at top and center and will be dismissed automatically, as a non-interrupting light-weighted prompt.

Examples#

import { useMessage } from 'tailor-ui';

Basic#

Customized duration#

Handle Promise#

API#

Methods#

  • message.info(content, [duration]) => Promise
  • message.success(content, [duration]) => Promise
  • message.warning(content, [duration]) => Promise
  • message.error(content, [duration]) => Promise

Argument#

ArgumentTypeDefaultDescription
contentstring | ReactNode-content of the message
durationnumber3000time(ms) before auto-dismiss.