Skip to content

Latest commit

 

History

History
160 lines (100 loc) · 2 KB

button.md

File metadata and controls

160 lines (100 loc) · 2 KB

Button

Overview

Buttons are simple controls that can be pressed.

<button text="press me!" ontap="foobar" />
actions.foobar = function ()
	print("you pressed a button!");
end

Properties

id

Set the ID for this control so that it can be updated later. See layout library.

<button id="my_btn" />

visibility

Set the visibility state using visible or invisible or gone.

<button visibility="gone" />

text

Set the text to be shown in the button.

<button text="hello world" />

textalign

Set horizontal text alignment using left or center or right.

<button text="foo" textalign="right" />

icon

Set a standard control icon. See icons list of available icons.

<button icon="select" />

image

Set a custom image to use. Should be an absolute path or relative to the layout file.

<button image="img.png" />

Styling

See the styling page for more details.

Events

ontap

Occurs when the button is tapped.

<button text="foo" ontap="foo_tapped" />
actions.foo_tapped = function ()
    ...
end

onhold

Occurs when the button is held down.

<button text="bar" onhold="bar_held" />
actions.bar_held = function ()
    ...
end

ondown

Occurs when the button is released.

<button text="hello" ondown="hello_down" />
actions.hello_down = function ()
    ...
end

onup

Occurs when the button pressed down.

<button text="world" onup="world_up" />
actions.world_up = function ()
    ...
end