The Button component in dill-pixel provides an interactive button implementation with support for different states, textures, sounds, and accessibility features.
Basic Usage
The simplest way to create a button is using the add.button() factory method:
Button Configuration
The button accepts several configuration options:
Button States
Buttons support multiple states with different textures:
default: Normal state
hover: When pointer is over the button
active: When button is pressed
disabled: When button is disabled
Event Handling
Buttons provide several signals for interaction:
Adding Content
You can add child elements to buttons using the factory methods:
Focus Management
Buttons automatically integrate with dill-pixel’s focus management system.
To enable focus management:
Example: Interactive Menu
Here’s a complete example showing button usage in a menu: