wijjit.elements.modal.ConfirmDialog
- class wijjit.elements.modal.ConfirmDialog(message, on_confirm=None, on_cancel=None, title='Confirm', classes=None, confirm_label='Confirm', cancel_label='Cancel', width=50, height=None, border_style='single', id=None)[source]
Confirmation dialog with confirm and cancel buttons.
This dialog presents a message with two buttons (Confirm/Cancel) and executes the appropriate callback based on user selection. The dialog automatically closes after a button is clicked.
- Parameters:
title (
str, optional) – Dialog title (default: “Confirm”)message (
str) – Confirmation message to displayon_confirm (
callable, optional) – Callback function called when Confirm button is clickedon_cancel (
callable, optional) – Callback function called when Cancel button is clickedconfirm_label (
str, optional) – Label for confirm button (default: “Confirm”)cancel_label (
str, optional) – Label for cancel button (default: “Cancel”)width (
int, optional) – Dialog width in characters (default: 50)height (
int, optional) – Dialog height in lines (default: 14)border_style (
str, optional) – Border style: “single”, “double”, or “rounded” (default: “single”)id (str | None)
- Variables:
- __init__(message, on_confirm=None, on_cancel=None, title='Confirm', classes=None, confirm_label='Confirm', cancel_label='Cancel', width=50, height=None, border_style='single', id=None)[source]
Methods
__init__(message[, on_confirm, on_cancel, ...])add_child(element)Add a child element.
add_class(class_name)Add a CSS class to this element.
apply_props(props)Apply props from a VNode, skipping ephemeral props.
calculate_content_bounds()Calculate the bounds available for content inside the frame.
get_ephemeral_state()Get ephemeral state that should survive reconciliation.
get_focusable_children()Get all focusable child elements.
get_hardware_cursor_position()Absolute screen cell where the hardware terminal cursor should park.
get_height_for_width(width)Return the height this element needs when laid out at
width.get_intrinsic_size()Get the intrinsic (preferred) size of the element.
handle_key(key)Handle key press by routing to focused child.
handle_mouse(event)Handle mouse event by routing to child at mouse position.
has_class(class_name)Check if element has a CSS class.
on_blur()Called when element loses focus.
on_focus()Called when element gains focus.
on_hover_enter()Called when mouse enters element.
on_hover_exit()Called when mouse exits element.
on_mount()Called when element is first added to the element tree.
on_unmount()Called when element is removed from the element tree.
on_update(changed_props)Called when element props are updated during reconciliation.
remove_child(element)Remove a child element.
remove_class(class_name)Remove a CSS class from this element.
render_signature()Hashable/comparable capture of everything
render_to()reads.render_to(ctx)Render the modal using cell-based rendering (NEW API).
restore_ephemeral_state(state)Restore ephemeral state after reconciliation.
set_bounds(bounds)Set the element's screen bounds.
set_content(content)Set the modal content text.
toggle_class(class_name)Toggle a CSS class on this element.
Attributes
captures_tabWhether this element wants the Tab key instead of focus movement.
parent_frameGet the parent Frame if this element is inside a scrollable frame.
supports_dynamic_sizingWhether this element supports dynamic sizing.