Skip to main content

Button

A clickable button that can bind a launcher action or function.

Signature

Attributes

Action parameters go directly on the Button as attributes or attribute elements; see the Actions reference.

Size / Variant values

Button.Size only accepts Sm / Md / Lg; the Xs–2Xl values of Text.Size do not apply to buttons. See Attribute values for the full table.

ShortcutKeys

  • Supports Alt / Ctrl / Shift / Meta modifiers and one main key.
  • You can also write <ShortcutKey Key="Alt+L" />.
  • Multiple ShortcutKey elements form one shortcut.
  • Shortcuts are ignored while an input is focused.
  • A shortcut runs the same OnClick / Click trigger as a button click.

Effects

Buttons support the same <Button.Effects> as other visual nodes:
See Effects for effect types and Trigger usage.

Content syntax

Equivalent to Text="刷新".

Runtime behavior

  • Renders the launcher Button component.
  • With an empty OnClick the button is clickable but does nothing.
  • A click first fires the Click trigger with the same Name, then runs OnClick.
  • In preview mode RunCommand / PluginApi do not execute.

Example

Gotchas

  • The action parameters of OnClick must belong to that action; wrong ones are rejected by XML validation.
  • Long button text widens the button; for wrapping, use Text inside a custom container, or shorten the text.
  • Name is not the display text; it only targets triggers.