toggle (cellium v0.1.0)
View SourceToggle widget module for on/off switches.
Toggles are focusable widgets that can be switched with Enter or Space.
They display as < ON > or < OFF >.
Usage
toggle:new(feature_toggle)Properties
on(boolean): Whether the toggle is on. Default: falsefocusable(boolean): Always true for togglesfocused(boolean): Set by focus manager when toggle has focus
Rendering
Format: < ON > or < OFF >
When focused, colors are inverted to highlight the toggle.
Summary
Functions
Handles keyboard events for the toggle. Toggles ON/OFF state on Space or Enter.
Creates a new toggle widget in the OFF state.
Renders the toggle widget to the buffer.
Renders the toggle in focused state with inverted colors.
Functions
Handles keyboard events for the toggle. Toggles ON/OFF state on Space or Enter.
Creates a new toggle widget in the OFF state.
Renders the toggle widget to the buffer.
Renders the toggle in focused state with inverted colors.