Skip to main content

UI/UX Components

Modules

Each cap-* primitive maps to an underlying component:

  • cap-uix-switchui-switch — Toggle switch (on/off).
    oaicite:1
  • cap-uix-layoutlayout — Layout container (box/circle/grid/etc.). Default type is box.
    oaicite:2
  • cap-uix-sliderui-slider — Select a value from a range.
    oaicite:3
  • cap-uix-icontroika-text — Icon primitive (defaults configured for a close icon).
    oaicite:4
  • cap-uix-carduix-card — Rounded rectangular container for content.
    oaicite:5
  • cap-uix-texttroika-text — 3D text in space.
    oaicite:6
  • cap-uix-buttonui-btn — Clickable button; mixes rounded.
    oaicite:7
  • cap-lineline2 — Draw a line in 3D space.
    oaicite:8
  • cap-box-roundeduix-box-rounded — Rounded box.
    oaicite:9
  • cap-triggergeometry — Interaction trigger; uses geometry, body, and trigger.
    oaicite:10
  • cap-model-loadergltf-model-plus — Load & display a glTF model.
    oaicite:11

cap-uix-switch ⇐ ui-switch

A toggle switch that allows the user to choose between two states (typically on/off).

oaicite:12

Extends

  • ui-switch
    oaicite:13

Properties

NameTypeDescription
valuebooleanValue of the switch.
oaicite:14
disabledbooleanWhether the switch is disabled.
oaicite:15

Example

<cap-uix-switch value="true"></cap-uix-switch>

cap-uix-layout ⇐ layout

A layout container that arranges its children in a specific layout (box, circle, grid-like layouts, etc.). Default type is box. ()

Extends

  • layout ()

Properties

NameTypeDescription
type'box' | 'circle' | 'cube' | 'dodecahedron' | 'line' | 'pyramid' | stringType of layout (default: box). ()
radiusnumberRadius of the layout. ()
anglenumberAngle of the layout. ()
columnsnumberNumber of columns in the layout. ()
margin-columnnumberMargin between columns. ()
margin-rownumberMargin between rows. ()
order-attributestringAttribute to order elements. ()
planebooleanWhether the layout is planar. ()
reversebooleanWhether to reverse the layout. ()
fillbooleanWhether to fill the layout. ()
alignstringAlignment of the layout. ()

Example

<cap-uix-layout type="circle" radius="1">
<a-entity geometry="primitive: box"></a-entity>
<a-entity geometry="primitive: sphere"></a-entity>
</cap-uix-layout>

cap-uix-slider ⇐ ui-slider

A slider that allows the user to select a value from a range. ()

Extends

  • ui-slider ()

Properties

NameTypeDescription
valuenumberValue of the slider. ()
disabledbooleanWhether the slider is disabled. ()
widthnumberWidth of the slider. ()
heightnumberHeight of the slider. ()
rail-radiusnumberRadius of the slider rail. ()
handle-radiusnumberRadius of the slider handle. ()

Example

<cap-uix-slider value="0.5"></cap-uix-slider>

cap-uix-icon ⇐ troika-text

An icon primitive (implemented using troika-text), with defaults configured for a close icon. ()

Extends

  • troika-text ()

Properties

NameTypeDescription
iconstringIcon value (supports material-symbols-rounded icon names from Google Font Icons). ()
colorstringColor of the icon. ()
sizenumberSize of the icon. ()

Example

<cap-uix-icon icon="home" color="red"></cap-uix-icon>

cap-uix-card ⇐ uix-card

A rectangular container with rounded corners, typically used to display content. ()

Extends

  • uix-card ()

Properties

NameTypeDescription
heightnumberHeight of the card. ()
widthnumberWidth of the card. ()
colorstringColor of the card. ()
radiusnumberRadius of the card corners. ()
opacitynumberOpacity of the card. ()
border-colorstringColor of the card border. ()
render-ordernumberRender order of the card. ()
border-widthnumberWidth of the card border. ()
border-opacitynumberOpacity of the card border. ()

Example

<cap-uix-card width="1" height="1" color="red">
<cap-uix-text value="Hello World!"></cap-uix-text>
</cap-uix-card>

cap-uix-text ⇐ troika-text

Displays text in 3D space using troika-text. ()

Extends

  • troika-text ()

Properties

NameTypeDescription
alignstringAlignment of the text. ()
anchorstringAnchor point of the text. ()
baselinestringBaseline alignment of the text. ()
clip-rectstringClip rectangle of the text. ()
colorstringColor of the text. ()
depth-offsetnumberDepth offset of the text. ()
fontstringFont of the text. ()
font-sizenumberFont size of the text. ()
letter-spacingnumberLetter spacing of the text. ()
line-heightnumberLine height of the text. ()
max-widthnumberMaximum width of the text. ()
outline-colorstringOutline color of the text. ()
outline-widthnumberOutline width of the text. ()
overflow-wrapstringOverflow wrap of the text. ()
render-ordernumberRender order of the text. ()
sidestringSide of the text. ()
tone-mappedbooleanWhether the text is tone-mapped. ()
valuestringValue of the text. ()
white-spacestringWhite space handling of the text. ()
y-offsetnumberY offset of the text. ()
z-offsetnumberZ offset of the text. ()

Example

<cap-uix-text value="Hello World!" color="red" font-size="0.5"></cap-uix-text>

cap-uix-button ⇐ ui-btn

A clickable button for triggering actions or navigation. Uses ui-btn and mixes rounded. ()

Extends / Mixes

  • Extends: ui-btn
  • Mixes: rounded ()

Properties

NameTypeDescription
heightnumberHeight of the button. ()
widthnumberWidth of the button. ()
colorstringColor of the button. ()
radiusnumberRadius of the button corners. ()
disabledbooleanWhether the button is disabled. ()
tooltip-textstringTooltip text. ()

Example

<cap-uix-button
value="Click Me!"
color="red"
width="1"
height="0.5"
></cap-uix-button>

cap-line ⇐ line2

Draws a line in 3D space. ()

Extends

  • line2 ()

Properties

NameTypeDescription
colorstringColor of the line. ()
widthnumberWidth of the line. ()
startstringStarting point of the line. ()
endstringEnding point of the line. ()

Example

<cap-line start="0 0 0" end="1 1 1" color="red" width="0.1"></cap-line>

cap-box-rounded ⇐ uix-box-rounded

A box with rounded corners. ()

Extends

  • uix-box-rounded ()

Properties

NameTypeDescription
depthnumberDepth of the box. ()
heightnumberHeight of the box. ()
widthnumberWidth of the box. ()
colorstringColor of the box. ()
transparentbooleanWhether the box is transparent. ()
opacitynumberOpacity of the box. ()
radiusnumberRadius of the box border. ()

Example

<cap-box-rounded
width="1"
height="1"
depth="1"
color="red"
radius="0.2"
></cap-box-rounded>

cap-trigger ⇐ geometry

A trigger component for detecting interactions in 3D space; built from geometry, body, and trigger. ()

Extends

  • geometry, body, trigger ()

Emits

  • collide — triggered when a collision occurs (regardless of local-trigger). ()
  • beginCollide — triggered when a collision begins (respects local-trigger). ()
  • endCollide — triggered when a collision ends (respects local-trigger). ()

Properties

NameTypeDescription
geometryObjectGeometry component settings. ()
geometry.primitivestringType of geometry primitive. ()
bodyObjectPhysics body component settings. ()
body.typestringType of physics body. ()
body.isTriggerbooleanWhether the body is a trigger. ()
local-triggerbooleanOnly interactions from local objects. ()
visiblebooleanDebug: show the collider geometry mesh. ()

Example

<cap-trigger
visible="false"
local-trigger="true"
@beginCollide=${(e) => {
console.info(e.target)
}}
@endCollide=${(e) => {
console.info(e.target)
}}
geometry="primitive:box;width:8;height:8;depth:8;">
</cap-trigger>

cap-model-loader ⇐ gltf-model-plus

A model loader for displaying 3D models, based on gltf-model-plus. ()

Extends

  • gltf-model-plus ()

Properties

NameTypeDescription
srcstringThe src to a glTF file. ()
env-map-intensitynumberIntensity of the environment map. ()
cast-shadowbooleanWhether the model casts shadows. ()
receive-shadowbooleanWhether the model receives shadows. ()

Example

<cap-model-loader src="#my-model-asset" cast-shadow="true"></cap-model-loader>