Interactive controls are focusableDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt
Use this file to discover all available pages before exploring further.
ControlBase subclasses that accept keyboard input and emit typed events. Terminality’s focus manager handles Tab-like navigation automatically when controls are placed inside layout containers. You do not wire up navigation manually — you configure the control’s behaviour through its properties and subscribe to its events.
Button
Button renders a labelled, clickable widget. It responds to Enter and Space when focused, visually toggles its pressed state, and fires the Clicked event on key-up. You can also trigger a click programmatically with Click().
Properties
The label rendered inside the button. Changing
Text invalidates the measure pass, so the button resizes to fit its new content automatically.Foreground (text) color applied while the button is held down.
Background color applied while the button is held down.
Events
Fired when the user releases Enter or Space while the button is focused, or when
Click() is called programmatically. Subscribe with +=.Methods
Programmatically activate the button: sets the pressed visual state, fires
Clicked, and then clears the pressed state on the next OnKeyUp. Use this to trigger button behaviour from hotkeys or external logic.Keyboard activation
The button interceptsInputKey::RETURN and InputKey::SPACE on OnKeyDown/OnKeyUp. It does not consume any other keys, so focus navigation through arrow keys works normally.
Example — status bar button with click handler
TextBox
TextBox is a single- or multi-line text input. It manages an internal cursor position, handles character insertion and deletion, and fires TextChanged after every edit. It is the primary control for accepting free-form text from the user.
Properties
The current contents of the text box. You can read and write this property at any time. Writing to it moves the cursor to the end of the new string.
How text that overflows the width is handled. Set to
TextWrap::Wrap or TextWrap::WrapWholeWords to enable multi-line editing.Horizontal alignment of the text within the control’s width.
When
true, the Enter key inserts a newline character instead of being passed to the parent. Set to false for single-line inputs where Enter should trigger submission logic via OnHotkey.Events
Fired after every keystroke that modifies
Text. Use this to implement live validation or character counters.Example — chat input with Enter-to-send
This pattern is taken fromMessangerTest in the test app. AcceptsReturn is false so Enter does not insert a newline, and OnHotkey intercepts InputKey::RETURN to submit the message.
OnHotkey is defined on ControlBase and is available on every control. It registers a key binding scoped to the control — the lambda receives a ControlBase* pointer to self, which you cast to the concrete type when needed.CheckBox
CheckBox is a three-state toggle: unchecked (false), checked (true), and indeterminate (std::nullopt). It renders a label alongside a state indicator and fires distinct events for each state transition.
Properties
The label text displayed next to the checkbox indicator.
Foreground color while the control is held down (key-press visual feedback).
Background color while the control is held down.
Events
Fired on every state change. The argument is the new value:
true, false, or std::nullopt (indeterminate). This is the most general event — subscribe here if you need to handle all three states.Fired when the state transitions specifically to
true. Convenience event if you only care about the checked state.Fired when the state transitions specifically to
false.Methods
Programmatically set the checkbox state. Pass
true, false, or std::nullopt for indeterminate. Fires the appropriate events just as a keyboard activation would.Keyboard activation
CheckBox intercepts Enter and Space (InputKey::RETURN / InputKey::SPACE) on OnKeyDown/OnKeyUp, cycling through its states the same way a mouse click would.
Example
Interactive control comparison
Interactive control comparison
| Control | Focus | Key bindings | Primary event | State |
|---|---|---|---|---|
Button | Yes | Enter, Space | Clicked | Stateless |
TextBox | Yes | All printable keys, Backspace, arrows | TextChanged | Text wstring |
CheckBox | Yes | Enter, Space | Toggled, Checked, Unchecked | optional<bool> |
Using OnHotkey for submission patterns
Using OnHotkey for submission patterns
All three controls inherit
OnHotkey from ControlBase. This lets you attach key bindings that are only active when a specific control is focused, without polluting global hotkey handlers.