TermUI.Widgets.AlertDialog (TermUI v0.2.0)
View SourceAlert dialog widget for standardized messages and confirmations.
Alert dialog is a specialized dialog with predefined button configurations and visual icons for different message types.
Usage
AlertDialog.new(
type: :confirm,
title: "Delete File",
message: "Are you sure you want to delete this file?",
on_result: fn result -> handle_result(result) end
)Alert Types
:info- Information message (i icon, OK button):success- Success message (✓ icon, OK button):warning- Warning message (⚠ icon, OK button):error- Error message (✗ icon, OK button):confirm- Confirmation dialog (? icon, Yes/No buttons):ok_cancel- OK/Cancel dialog (OK/Cancel buttons)
Keyboard Navigation
- Tab/Shift+Tab: Move between buttons
- Enter/Space: Activate focused button
- Escape: Close (same as Cancel/No)
- Y: Yes (in confirm dialogs)
- N: No (in confirm dialogs)
Summary
Functions
Gets the currently focused button.
Gets the alert type.
Hides the alert.
Creates new AlertDialog widget props.
Updates the message.
Shows the alert.
Gets whether the alert is visible.
Functions
Gets the currently focused button.
Gets the alert type.
Hides the alert.
Creates new AlertDialog widget props.
Options
:type- Alert type (required): :info, :success, :warning, :error, :confirm, :ok_cancel:title- Dialog title (required):message- Message to display (required):on_result- Callback with result (:ok, :cancel, :yes, :no):width- Dialog width (default: 50):icon_style- Style for the icon:message_style- Style for the message:button_style- Style for buttons:focused_button_style- Style for focused button
Updates the message.
Shows the alert.
Gets whether the alert is visible.