Button

Button小部件是一个可自定义的交互式UI元素,用于响应用户操作,如点击、按下和释放。它包括背景、文本和图标渲染的属性,并支持不同状态(例如悬停、按下)的动画。

The Button widget is a customizable, interactive UI element that responds to user actions such as clicks, presses, and releases. It includes properties for background, text, and icon rendering, and supports animations for different states (e.g., hover, pressed).

Props

decoratenametypedescription
animatoranimatorAnimatorControls the animations for the button states.
redrawdraw_bgDrawQuadDraws the background of the button.
livedraw_textDrawTextDraws the text label of the button.
livedraw_iconDrawIconDraws the icon for the button.
liveicon_walkWalkDefines the walk properties for the icon.
livelabel_walkWalkDefines the walk properties for the label.
walkwalkWalkDefines the walk properties for the button.
layoutlayoutLayoutDefines the layout properties for the button.
livegrab_key_focusboolDetermines if the button should grab key focus when interacted with.
livetextRcStringMutThe text label displayed on the button.

See Walk

See Layout

See DrawText

See DrawQuad

See DrawIcon

Event

namedescription
ClickedTriggered when the button is clicked.
PressedTriggered when the button is pressed.
ReleasedTriggered when the button is released.