This commit is contained in:
NoryiE
2025-10-29 16:56:08 +00:00
parent 9a5b46138e
commit 00a9ce5632
26 changed files with 812 additions and 77 deletions

View File

@@ -3,6 +3,87 @@ _A clickable interface element that triggers actions when pressed. Supports text
Extends: `VisualElement`
## Usage
```lua run
-- Create a simple action button
```
```lua run
local button = parent:addButton()
```
```lua run
:setPosition(5, 5)
```
```lua run
:setText("Click me!")
```
```lua run
:setBackground(colors.blue)
```
```lua run
:setForeground(colors.white)
```
```lua run
```
```lua run
-- Add click handling
```
```lua run
button:onClick(function(self, button, x, y)
```
```lua run
-- Change appearance when clicked
```
```lua run
self:setBackground(colors.green)
```
```lua run
self:setText("Success!")
```
```lua run
```
```lua run
-- Revert after delay
```
```lua run
basalt.schedule(function()
```
```lua run
sleep(1)
```
```lua run
self:setBackground(colors.blue)
```
```lua run
self:setText("Click me!")
```
```lua run
end)
```
```lua run
end)
```
## Properties
|Property|Type|Default|Description|