Skip to content

Buttons

action

Alias for button that creates a button element with a type of action. Spaces in the name are replaced with dashes instead of underscores.

  • buttonObj - object -

    The object describing the button

  • block - block -

    The contents of the button element

Example

pug
include k-scaffold
+action({name:'my button','data-i18n':'action button',trigger:{triggeredFuncs:['doSomethingOnClick']}})
include k-scaffold
+action({name:'my button','data-i18n':'action button',trigger:{triggeredFuncs:['doSomethingOnClick']}})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
<button name="act_my-button" data-i18n="action button" type="action"></button>
<button name="act_k-network-call" hidden="" type="action"></button>
<button name="act_my-button" data-i18n="action button" type="action"></button>

button

Creates a button element. Valid types are roll or action. If a type is not specified in the object argument, a roll button is created. If an action button is created, spaces in the name are replaced with dashes instead of underscores.

  • buttonObj - object -

    The object describing the button

  • block - block -

    The contents of the button element

Example

pug
include k-scaffold
//A basic roll button
+button({name:'my button',value:'/r 3d10'})
//An action button
+button({name:'my button',type:'action','data-i18n':'action button',trigger:{triggeredFuncs:['doSomethingOnClick']}})
include k-scaffold
//A basic roll button
+button({name:'my button',value:'/r 3d10'})
//An action button
+button({name:'my button',type:'action','data-i18n':'action button',trigger:{triggeredFuncs:['doSomethingOnClick']}})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
<!--A basic roll button-->
<button name="roll_my_button" value="/r 3d10" type="roll"></button>
<!--An action button-->
<button name="act_my-button" type="action" data-i18n="action button"></button>
<button name="act_k-network-call" hidden="" type="action"></button>
<!--A basic roll button-->
<button name="roll_my_button" value="/r 3d10" type="roll"></button>
<!--An action button-->
<button name="act_my-button" type="action" data-i18n="action button"></button>

roller

Creates a multi element construction made of a hidden input, a roll button, and a hidden action button. On sheet load, or character sheet name change, the hidden input is updated with an ability call to the action button. The roll button refers to the hidden input as its value. This allows for an action button to be used to call custom roll parsing (or other sheet functionality) while retaining the ability to drag the button to the macro bar. Uses the same arguments as button. A trigger should be passed, and will be associated with the action button's name.

  • buttonObj - object -

    The object describing the button

  • block - block -

    The contents of the button element

Example

pug
include k-scaffold
+roller({name:'my button','data-i18n':'action button',trigger:{triggeredFuncs:['doSomethingOnClick']}})
include k-scaffold
+roller({name:'my button','data-i18n':'action button',trigger:{triggeredFuncs:['doSomethingOnClick']}})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
<button class="roller" name="roll_my_button" data-i18n="action button" value="@{my_button_action}" type="roll"></button>
<button name="act_my-button-action" hidden="" type="action"></button>
<input name="attr_my_button_action" type="hidden" title="@{my_button_action}"/>
<button name="act_k-network-call" hidden="" type="action"></button>
<button class="roller" name="roll_my_button" data-i18n="action button" value="@{my_button_action}" type="roll"></button>
<button name="act_my-button-action" hidden="" type="action"></button>
<input name="attr_my_button_action" type="hidden" title="@{my_button_action}"/>

Released under the MIT License