Skip to content

Icon Button ​

A circular button showing an icon instead of text. Icons come from the SenangStart icon set and are referenced by slug.

a-sxr-icon-button Component ​

Properties ​

PropertyDescriptionDefault Value
onEvent that triggers onclick actionclick
font-colorText color for button label#F1F5F9
border-colorBorder color of button#1B1B1F
background-colorBackground color of item#202127
hover-colorBackground color when button is in hover state#0EA5E9
active-colorBackground color when button is pressed down#2563EB
iconSenangStart icon slug, e.g. check, play, cog-6-toothcheck
icon-activeIcon slug for the active state''
icon-fontLegacy option retained for compatibility''
icon-font-sizeIcon size for button0.4
icon-occlusionLet scene geometry occlude the icon (opt-in depth test)false
keyTextual shortcut key that activates the widget (e.g. 'e')
key-codeLegacy numeric shortcut key (e.g. 32 for Space)-1
toggleToggle statusfalse
toggle-stateSetting the toggle button on/off statefalse
heightHeight of item1
widthWidth of item1
marginMargin around item0 0 0 0
html
<a-sxr-icon-button
	height="0.75"
	onclick="buttonActionFunction" key-code="32"
	icon="star"
	margin="0 0 0.05 0"
>
</a-sxr-icon-button>

Icons ​

icon takes a slug from the icon set — 246 icons are available (check, play, cog-6-tooth, sparkles, …). An unknown slug falls back to a ? glyph rather than failing.

icon-active swaps the displayed icon while the button is pressed, which is the usual way to show a pressed/confirmed state:

html
<a-sxr-icon-button icon="play" icon-active="pause"></a-sxr-icon-button>

icon-font is a legacy option retained for compatibility; new scenes should use icon.

Toggle mode ​

toggle="true" latches the button on and off, with the state held in toggle-state.

Occlusion ​

Icons draw on top of scene geometry by default. Set icon-occlusion="true" to let scene geometry occlude the icon — see Occlusion.