<button> element

An intractable button element.

Attributes

AttributeValueDescriptionExample
actionstringAction for the button to perform when clickedaction="cmd: tp %player% 0 100 0"
action-triggerstringSpecifies whether left or right clicking
triggers the action attribute.
"left" by default.
action-trigger="right"
enabledbooleanDisables / enables the buttonenabled="false"

Action attribute

Makes the button element to perform an action when clicked.

ActionDescriptionExample
closeCloses the menuclose
cmd: <command>Executes a command as console.
You can use %player% as a placeholder for the player’s name
cmd: kill %player%
player-cmd: <command>Executes a command as the player.
You can use %player% as a placeholder for the player’s name
player-cmd: balance

Action triggers:

ValueTriggers
leftWhen the button is left-clicked (Punched)
rightWhen the button is right-clicked (Interacted with)

Default Styling

button {
  $button-bg: #096cfe;

  display: inline;
  color: white;
  background-color: $button-bg;
  border-color: #121212;
  padding: 0.5px;
  border: 0.5px;

  &:hover {
    background-color: lighten($button-bg, 20%);
  }
  &:active {
    background-color: darken($button-bg, 25%);
  }
}

Examples

<button>Button text</button>
<button action="close">Close Menu</button>
<button action="cmd: kill %player%">Kill Self</button>
<button enabled="false" action="cmd: give %player% pumpkin_pie 64">Get some pumpkin pies :)</button>