.. default-domain:: lua .. highlight:: lua .. currentmodule:: UI Button ====== .. class:: Button A button that the user can click. Added to a :class:`UI.Canvas` or a :class:`UI.Panel`. | Base class: :class:`UI.Control` .. container:: inherited-members .. rubric:: Inherited Members * From :class:`UI.Control`: :attr:`interactable `, :attr:`color `, :attr:`tooltip ` * From :class:`UI.Object`: :attr:`rect_transform `, :attr:`layout_element `, :attr:`visible `, :meth:`remove ` .. attribute:: text: UI.Text The text for the button. :Attribute: Read-only, cannot be set .. attribute:: clicked: boolean Whether the button has been clicked. :Attribute: Can be read or written .. note:: This property is set to true when the user clicks the button. A client script should reset the property to false in order to detect subsequent button presses. .. attribute:: pressed: boolean Whether the user is holding the button down right now. :Attribute: Read-only, cannot be set .. note:: True from the button being pressed until the pointer is released, however far it has moved by then. Polling this repeats an action for as long as the button is held, for nudging a value; :attr:`UI.Button.clicked` reports each completed click instead.