wijjit.elements.menu.DropdownMenu

class wijjit.elements.menu.DropdownMenu(id=None, classes=None, items=None, trigger_text='Menu', trigger_key=None, width=30, border_style=BorderStyle.SINGLE)[source]

Dropdown menu element.

A dropdown menu appears below (or above) a trigger element when activated. It supports keyboard shortcuts and auto-positioning to stay on screen.

Parameters:
  • id (str, optional) – Unique identifier

  • items (list of MenuItem, optional) – Menu items to display

  • trigger_text (str, optional) – Text for the trigger button (default: “Menu”)

  • trigger_key (str or None, optional) – Keyboard shortcut to open menu (e.g., “Alt+F”)

  • width (int, optional) – Menu width (default: 30)

  • border_style (BorderStyle or str, optional) – Border style (default: BorderStyle.SINGLE)

  • classes (str | list[str] | set[str] | None)

Variables:
  • trigger_text (str) – Text for the trigger button

  • trigger_key (str or None) – Keyboard shortcut to open menu

  • trigger_bounds (Bounds or None) – Bounds of the trigger element (for positioning)

__init__(id=None, classes=None, items=None, trigger_text='Menu', trigger_key=None, width=30, border_style=BorderStyle.SINGLE)[source]
Parameters:
Return type:

None

Methods

__init__([id, classes, items, trigger_text, ...])

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.

get_ephemeral_state()

Get ephemeral state for 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 keyboard input for menu navigation.

handle_mouse(event)

Handle mouse input for menu interaction.

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 menu using cell-based rendering (NEW API).

restore_ephemeral_state(state)

Restore ephemeral state after reconciliation.

set_bounds(bounds)

Set the element's screen bounds.

toggle_class(class_name)

Toggle a CSS class on this element.

Attributes

captures_tab

Whether this element wants the Tab key instead of focus movement.

parent_frame

Get the parent Frame if this element is inside a scrollable frame.

supports_dynamic_sizing

Whether this element supports dynamic sizing.