Feedback — Notice
Anatomy
blocks::feedback::notice keeps the outcome visible. Lead with a sentence such as “Guest saved.” or “The payment could not be recorded.” Add recovery guidance in description; reserve details for diagnostic text behind a native disclosure. Errors use role="alert"; other results use status. Nothing auto-dismisses or steals focus on success.
use maud_ui::blocks::feedback::notice::{self, Props, Tone};
let saved = notice::render(Props {
message: "Guest saved.".into(),
description: Some("Leila Morgan is ready for a booking.".into()),
tone: Tone::Success,
..Default::default()
});
notice::region("save-result") creates an empty region for dynamic outcomes. MaudUI.notice(element, {status: 'error', message, description, details}) safely inserts text, including diagnostic characters. A blank error message falls back to “Your changes could not be saved.” The application maps transport codes and business failures into appropriate human wording.
See Form for pending, validation and the response contract; Confirm for a deliberate action. Run the interactive workflow fixtures for success, validation failure, server failure and retry.
maud_ui::blocks::feedback::notice
Props
Generated from public Rust fields. Defaults are evaluated from the implementation.
| Prop | Type | Default | Description |
|---|---|---|---|
id | Option<String> | None | No description |
message | String | "Changes saved." | A complete human sentence, e.g. "The guest could not be saved." |
description | Option<String> | None | Helpful next step or record context, before technical details. |
details | Option<String> | None | Optional diagnostics, behind a native Details disclosure. |
tone | Tone | Info | No description |
action | Option<Link> | None | No description |
Examples
light · fictional example
Leila Morgan is ready for a booking.
Ask a manager to record this payment. Your entries are still here.
Details
Payment creation is unavailable for this role. Reference: N6-403.
dark · fictional example
Leila Morgan is ready for a booking.
Ask a manager to record this payment. Your entries are still here.
Details
Payment creation is unavailable for this role. Reference: N6-403.
Accessibility
Supply meaningful labels, choose heading levels for the surrounding page, and preserve native link and form behavior. Keyboard focus follows document order. Motion honors reduced-motion preferences.