Labels, Badges, and Toasts
Use display controls to show text, status, feedback, and lightweight progress.
Main controls and helpers
| Control/helper | Use it for |
|---|---|
Mui::Label |
Normal text |
Mui::CaptionLabel |
Smaller secondary text |
Mui::Badge |
Short status value |
Mui::StatusRow |
Label plus badge row |
Mui::Toast |
Temporary feedback |
Mui::ToastSuccess |
Success feedback |
Mui::ToastWarning |
Warning feedback |
Mui::ToastError |
Error/danger feedback |
Mui::Alert |
Inline alert/banner |
Mui::Progress |
Progress bar |
Labels
MuiLabel *title=Mui::Label(parent,"Connection ready");
MuiLabel *hint=Mui::CaptionLabel(parent,"Last checked on timer update.");
Update live text:
if(title!=NULL)
{
title.Text("Connection lost");
title.Refresh();
}
Use Mui::CaptionLabel for supporting text, field hints, helper notes, and low-emphasis information.
Badges
MuiBadge *badge=Mui::Badge(parent,"Ready",MUI_BADGE_SUCCESS);
Badges work well for compact states such as:
- Ready
- Running
- Demo
- Warning
- Error
- Connected
- Disabled
StatusRow
StatusRow is a fast wrapper that creates a label plus badge.
MuiStatusRow row=Mui::StatusRow(parent,"Status","Ready","success");
if(row.badge!=NULL)
{
row.badge.Text("Stopped");
row.badge.Variant(MUI_BADGE_NEUTRAL);
}
Variant strings include:
| String | Meaning |
|---|---|
neutral |
Default/normal |
primary |
Primary status |
success |
Positive/ready |
warning |
Needs attention |
danger |
Error/risky |
error |
Alias for danger |
info |
Informational |
Toasts
Toasts are temporary messages.
Mui::Toast(g_ui,"Settings saved");
Mui::ToastSuccess(g_ui,"Connected");
Mui::ToastWarning(g_ui,"Check risk value.");
Mui::ToastError(g_ui,"Action failed.");
Use toasts for short feedback. Do not use them for confirmations that require a decision.
Alert banners
MuiAlertBanner *alert=Mui::Alert(parent,"Check your settings",MUI_SEMANTIC_WARNING);
Use alerts for persistent messages that should remain visible in the panel.
Progress
MuiProgressBar *progress=Mui::Progress(parent,0.35,220.0,10.0);
A progress value is usually between 0.0 and 1.0.
Common patterns
Compact panel footer
Mui::StatusRow(parent,"Status","Ready","success");
Mui::StatusRow(parent,"Connection","Demo","info");
Handler feedback
virtual void OnChanged(MuiRoot &root,MuiEvent &e)
{
Mui::ToastSuccess(root,"Updated");
}
Common mistakes
Using toasts for important warnings
Toasts disappear. Use an alert, badge, dialog, or persistent status row when the user must notice something.
Forgetting to refresh after manual text updates
Some controls refresh themselves from setters. If you update a custom/composite label path and do not see changes, call Refresh() on the control or g_ui.RefreshAll().
Overusing badges
Badges are best for short state labels. Do not put long sentences inside badges.
Related pages
- Display —
MuiLabel,MuiBadge,MuiProgressBar,MuiCard - Overlays —
MuiAlertBanner, toast service Mui::Toast·Mui::StatusRow- Toast, StatusRow, and DrawerSection
- Buttons
- Styling and setter naming