button (cellium v0.1.0)
View SourceButton widget module for interactive clickable buttons.
Buttons are focusable widgets that can be activated with Enter or Space. When focused, they display with inverted colors or a border to indicate selection.
Usage
button:new(submit_btn, "Submit")Properties
label(string): The text displayed on the buttonfocusable(boolean): Always true for buttonsfocused(boolean): Set by focus manager when button has focusheight(integer): If >= 3, renders with a box border
Rendering
- Height < 3: Simple text with brackets when focused:
[Submit] - Height >= 3: Bordered box with centered label (double border when focused)
- Focused state inverts foreground/background colors
Summary
Functions
Handles keyboard events for the button. Emits button_clicked event on Enter or Space.
Creates a new button widget with default label 'Button'.
Creates a new button widget with the specified label.
Renders the button widget to the buffer.
Functions
Handles keyboard events for the button. Emits button_clicked event on Enter or Space.
Creates a new button widget with default label 'Button'.
Creates a new button widget with the specified label.
Renders the button widget to the buffer.