Skip to content

Tabs ​

The tabs component is an interactive UI element that allows users to switch between multiple pieces of content within the same space. Each tab acts as a trigger that reveals its associated content while hiding the others, helping organize information in a clear and structured way.

Examples ​

Basic Tabs ​

The first example demonstrates a simple usage of the tabs component. Each tab is linked to a separate content entity containing an image. The component uses default dimensions, styling, and built-in navigation, making it ideal for quick setups or simple image galleries in AR scenes.


Custom Content ​

The second example showcases how the tabs component can be used with fully custom 3D content instead of images. Each tab displays a different 3D primitive (sphere, box, cylinder), demonstrating flexibility in content rendering.

Props ​

PropertyTypeDefaultDescription
visiblebooleantrueDetermines whether the tabs component is visible in the scene.
positionnumber[]0 0 0Defines the 3D position of the tabs in the format [x, y, z].
opacitynumber1Defines the transparency of the entire tabs component (0 = fully transparent, 1 = fully visible).
sizeenum (small, medium, large, extra-large)mediumAdjusts the overall size of the tabs component.
colorstring (blue, #fff)#ECECECSets the default background or inactive tab color.
activecolorstring#00BA92Defines the color of the currently active tab, helping users identify the selected state.
modestring (light, dark)""Controls the visual theme of the component, supporting either a light or dark mode.
tabitemsarray ([{ "label": "Label", "content": "#content" }])[]Defines the tabs. Each item includes a label (tab title) and content (selector referencing the content entity to display).

Events ​

The tabs component emits the following event when the active tab changes:

EventParametersDescription
tab-changed{ value: object }Emitted whenever a different tab is selected. Returns the active tab item (with its label and content).

Note

You can listen to the tab-changed event to react whenever the user switches tabs.

js
el.addEventListener("tab-changed", (event) => {
  console.log(event.detail.value);
});