For AI agents: the complete documentation index is available at https://ifhover.github.io/leaf-ui/v/0.6.0/en/llms.txt, the full documentation bundle is available at https://ifhover.github.io/leaf-ui/v/0.6.0/en/llms-full.txt, and this page is available as Markdown at https://ifhover.github.io/leaf-ui/v/0.6.0/en/components/message.md.
Wrap your application in ConfigProvider. It manages messages automatically, so pages and business components can call useMessage directly.
import { ConfigProvider } from '@ifhover/leaf-ui';export function Root() { return <ConfigProvider><App /></ConfigProvider>;}
Applications already using ConfigProvider need no additional setup. Call useMessage in its descendants; the returned message can also be passed to business functions.
If your application has no ConfigProvider, add MessageProvider at the entry point. An explicit MessageProvider also creates an independent queue for a region.
import { MessageProvider } from '@ifhover/leaf-ui';export function Root() { return <MessageProvider><App /></MessageProvider>;}
Prefer useMessage. Update a loading message with its key to show the result. Timers pause while a message is hovered or focused and resume with the remaining time.
Components under the same entry provider share a queue. close() closes all its messages; close(key) closes one. Nested ConfigProvider regions share that queue, while each message keeps the theme and language of the calling component.
Messages continue after the calling component unmounts, and asynchronous work can update them through the same message instance. Unmounting the entry provider clears its messages and timers. Separate React applications and SSR requests have independent queues.
Message also supports declarative rendering; set open=false after onClose.