Overview
TheNotice class displays temporary notifications at the top of the Obsidian window. Use notices to provide feedback about actions, display errors, or communicate important information to users.
Since: 0.9.7
Constructor
The message to display. Can be a simple string or a DocumentFragment for rich content.
Time in milliseconds to show the notice. If set to
0, the notice will stay visible until the user manually dismisses it. Default duration is typically a few seconds.Properties
The notice element. Deprecated: Use
messageEl instead.Since: 0.9.7The outer container element of the notice.Since: 1.8.7
The element containing the notice message. You can modify this element to add custom content.Since: 1.8.7
Methods
setMessage()
Changes the message displayed in the notice.The new message to display
this (for chaining)
Since: 0.9.7
hide()
Manually dismisses and hides the notice.Examples
Basic Success Notice
Error Notice
Loading Notice with Update
Rich Content Notice
Persistent Notice with Manual Control
Best Practices
- Use notices sparingly to avoid overwhelming users
- Keep messages concise and actionable
- Use appropriate durations (2-5 seconds for most notices)
- Reserve persistent notices (duration = 0) for critical information that requires acknowledgment
- Include emoji or icons to quickly convey message type (✅ success, ❌ error, ℹ️ info)
See Also
- Modal - For more complex user interactions requiring a full modal dialog