Button
A clickable button UI element with text content.
Extends TextView to display text and adds click interaction, keyboard support, and visual feedback for hover and pressed states. Supports two visual styles:
- DEFAULT: Standard button with solid background
- OVERLAY: Transparent button suitable for overlays
Features:
- Mouse/touch click support
- Keyboard navigation (Tab to focus, Enter to click)
- Visual feedback for hover, pressed, focused, and disabled states
- Customizable theme integration
- Transform animation when pressed
Instance Members
Default is false
, automatically set to true
when any of this instance's observable variables has changed.
Custom theme override for this button
If this field is managed by a WindowItem, this is the WindowItem.
Whether the button is currently pressed (mouse/touch down)
Visual style of the button (DEFAULT or OVERLAY)
Whether the button is enabled and can be interacted with
Computed property that returns true if this button has keyboard focus. Updates automatically when focus changes.
Gives keyboard focus to this button. The button will respond to keyboard events when focused.
Returns whether this button can receive tab focus. Only enabled buttons can be tab-focused.
Returns | Description |
---|---|
Bool | True if tab focus is allowed |
Called when this button receives tab focus. Gives keyboard focus to the button.
Called when escape is pressed while this button has focus. Removes focus from the button.
Creates a new Button with default styling and interaction handlers.
Private Members
Click detection component for mouse/touch interaction
Tracks mouse hover state
Tracks Enter key press state for visual feedback
Event when any observable value as changed on this instance.
Name | Type |
---|---|
instance |
Button |
fromSerializedField |
Bool |
Event when theme field changes.
Name | Type |
---|---|
current |
Theme |
previous |
Theme |
Emitted when the button is clicked (via mouse, touch, or Enter key)
Event when inputStyle field changes.
Name | Type |
---|---|
current |
Anonymous |
previous |
Anonymous |
Event when enabled field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Event when focused field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Event when hover field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Event when enterPressed field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Handles key down events. Triggers click on Enter key when focused.
Name | Type | Description |
---|---|---|
key |
ceramic.Key | The key event |
Name | Type |
---|---|
key |
ceramic.Key |
Updates the button's visual appearance based on its state. Applies different styles for hover, pressed, focused, and disabled states. Includes a subtle transform animation when pressed.
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |