Web Components Reference
Viewer and Utilities Tags
<hoops-web-viewer>
Encapsulated HOOPS Web Viewer component within an HTML tag. It provides a seamless way to integrate the viewer into your web application.
Attributes:
All fields in the WebViewerConfig
object can be set as attributes on the tag.
The following attributes aren’t exposed:
* containerId
* container
* buffer
The complete list of attributes is as follows:
endpointUri
- string - Specifies the endpoint to be used by the viewer. This can be of type: http, https or ws.model
- string - Specifies the instance name to be loaded. This option is required if you specify an endpointUri of type ws:// or wss://.sessionToken
- string - An arbitrary value used for authentication. If used, it must match the token expected by the server for connection to proceed.rendererType
- string - Specifies the renderer type to be used. Default value isClient
. Use “server” to use server conversion. Any other value will perform file conversion on the client.empty
- boolean - Whether the viewer should be started without connecting to a server or loading a model.usePointerEvents
- boolean - Specifies whether pointer events should be used when available. Setting this option to false can be useful when using web views in GUI toolkits that rely on Internet Explorer. Default value istrue
.streamingMode
- string - Sets the streaming mode that the viewer will use. Default value isInteractive
.memoryLimit
- number - Controls the amount of mesh data present on the client machine at a given time. This value is expressed in Mebibytes (https://en.wikipedia.org/wiki/Mebibyte). Default value is0
indicating no limit.boundingPreviewMode
- string - Specifies what types of bounding previews should be rendered. Default value isAll
.defaultMeshLevel
- number - Specifies which mesh detail level will be used to initially stream the model. The default value is0
.streamCutoffScale
- number - Specifies a scale factor that will be applied to the streaming size cutoff. A value of 0 will disable the cutoff. The value should be in the interval of [0.0, 2.0]. If unspecified, this value will default to 1.0 for streaming sessions and 0.0 (disabled) for file based sessions.disableAutomaticBackgroundSheets
- boolean - If true, then automatic generation of background sheets for drawings is not performed when the drawing is loaded.disableAutomaticFloorplanOverlay
- boolean - If true, then the floorplan overlay capability will not be displayed automatically for BIM enabled models.calculateDefaultViewAxes
- boolean - If true, the default view axes will be calculated from the initial camera unless explicitly set during authoring time. Default value istrue
.disableAutomaticFitWorld
- boolean - If true, disable automatic fitworld on camera activation when there is no camera on view.enableShatteredModelUiViews
- boolean - If true, then CAD views contained within external models will populate the model tree UI.enginePath
- string - Path containing the graphics engine .wasm files. Follows the same rules as the src attribute of an HTML script tag.defaultMetallicFactor
- number - Sets a default metallic factor that will be applied to ALL non-PBR materials in the scene. Acceptable value range is (0.0 - 1.0). IfdefaultRoughnessFactor
is specified and this value is omitted, a value of 1.0 will be assumed.defaultRoughnessFactor
- number - Sets a default roughness factor that will be applied to ALL non PBR materials in the scene. Acceptable value range is (0.0 - 1.0). IfdefaultMetallicFactor
is specified and this value is omitted, a value of 1.0 will be assumed.
Events:
All the callbacks available in the CallbackMap
object used in WebViewer.setCallbacks
are available as events in this component. They are prefixed with ‘hwv’, for example: hwvAssemblyTreeReady
or hwvCamera
.
In addition, the following events are available:
- ‘hwvReady’:
CustomEvent<WebViewer>
: triggered when the internalWebViewer
is created and started.
<hoops-model-tree>
Displays the AssemblyTree structure. Can be bound to the WebViewer.model
. Events are available for selection and visibility management, enhancing interaction with the model hierarchy.
Attributes:
The component has no attributes, but the HoopsModelTreeElement
class has the following properties to configure and interact with the tree:
selected
- number[] - The list of selected node ids.model
- IModel - The model to be displayed in the tree. This is typically theWebViewer.model
.
Events:
- ‘hoops-model-tree-node-click’:
ModelTreeNodeClickEvent
- ‘hoops-model-tree-node-visibility-change’:
ModelTreeNodeVisibilityClickEvent
<hoops-layer-tree>
Displays the layers from the AssemblyTree with associated nodes. Can be bound to the WebViewer.model
. Events are available for selection and visibility management, allowing for detailed layer control.
Attributes:
The component hasn’t any attributes, but the HoopsLayerTreeElement
class has the following properties to configure and interact with the tree:
layersContainer
- ILayerContainer - The layers interface to display in the tree. This is typically theWebViewer.model
.
Events:
- ‘hoops-layer-tree-element-click’:
LayerTreeElementClickEvent
- ‘hoops-layer-tree-node-selected’:
LayerTreeNodeSelectedEvent
- ‘hoops-layer-tree-visibility-changed’:
LayerTreeVisibilityChanged
<hoops-view-tree>
Displays the views from the AssemblyTree. Can be bound to the WebViewer.model
. Events are available for selection, facilitating view management.
Attributes:
The component has no attributes, but the HoopsViewTreeElement
class has the following properties to configure and interact with the tree:
selected
- number[] - The list of selected view ids.model
- IModel - The model interface where the views are queried to be displayed in the tree. This is typically theWebViewer.model
.
Events:
- ‘hoops-view-tree-node-click’:
ViewTreeNodeClickEvent
<hoops-web-viewer-context-manager>
The context manager is a logical component to synchronize UI web viewer components states around the web viewer.
It is an internal component responsible of making changes in the web viewer and store states as a single source of truth. States are propagated using the Context Community Protocol (https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md) by the W3C’s Web Components Community Group.
The hoops-web-viewer-context-manager
component must be an ancestor of a UI component to be able to propagate states to it.
<hoops-info-button>
A button component with default icon for “about” section.
Logic to toggle the visibility of any info panel must be handled by the application with the default click
event.
Attributes:
tabindex
- string - The tabindex of the button. Default is ‘0’.role
- string - The role of the button, e.g., ‘button’. Default is ‘button’.size
- string - The size of the icon. Default is ‘md’.color
- ‘default’ | ‘accent’ - The color state of the button. Default is ‘default’.
<hoops-cad-configuration-list>
A list component that displays the available CAD configurations for the model. It allows users to select a configuration and apply it to the model.
Can be bound to the WebViewer.model
. Event is available for configuration selection.
Attributes:
The component hasn’t any attributes, but the ``HoopsCadConfigurationListElement``class has the following properties to configure the component:
model
- IModel - The model interface where the configurations are queried to be displayed. This is typically theWebViewer.model
.active
- number - The id of the active configuration. undefined if no configuration is active.
Events:
- ‘hoops-cad-configuration-list-click’:
CadConfigurationListClickEvent
<hoops-toolbar-cad-configuration>
A button component with default icon that represents CAD configurations.
Logic to toggle the visibility of the CAD configurations must be handled by the application with the default click
event.
Attributes:
color
- ‘default’ | ‘accent’ - Color state of the button. Default is ‘default’. It’s usually set to ‘accent’ when the CAD configurations panel is open.
<hoops-toolbar-camera-operator>
A button component that provides selection of the active camera operator through a dropdown menu.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
Attributes:
dropDownPosition
- ‘bottom’ | ‘top’ | ‘right’ | ‘left’ - Specifies the position of the dropdown menu relative to the button. Default is ‘right’.
<hoops-toolbar-camera>
A button component that provides basic camera operations such as projection modes and generic views through a dropdown menu.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
Attributes:
dropDownPosition
- ‘bottom’ | ‘top’ | ‘right’ | ‘left’ - Specifies the position of the dropdown menu relative to the button. Default is ‘right’.
<hoops-toolbar-drawmode>
A button component that provides selection of the current draw mode such as “shaded” or “wireframe” through a dropdown menu.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
Attributes:
dropDownPosition
- ‘bottom’ | ‘top’ | ‘right’ | ‘left’ - Specifies the position of the dropdown menu relative to the button. Default is ‘right’.
<hoops-toolbar-explode>
A button component that provides control over the explode state of the model through a dropdown menu and a slider.
Link to the WebViewer
must be established by passing the WebViewer
instance to the hoops-toolbar-explode
component.
Attributes:
webViewer
- WebViewer - The instance of theWebViewer
to which the explode state will be applied.dropDownPosition
- ‘bottom’ | ‘top’ | ‘right’ | ‘left’ - Specifies the position of the dropdown menu relative to the button. Default is ‘right’.
<hoops-toolbar-home>
A button component that provides a basic home button functionality, allowing users to return to a default model state.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
<hoops-toolbar-layers>
A button component with default icon that represent layers.
Logic to toggle the visibility of the layers must be handled by the application with the default click
event.
Attributes:
color
- ‘default’ | ‘accent’ - Color state of the button. Default is ‘default’. It’s usually set to ‘accent’ when the layer panel is open.
<hoops-toolbar-model-tree>
A button component with default icon that represents the model tree.
Logic to toggle the visibility of the model tree must be handled by the application with the default click
event.
Attributes:
color
- ‘default’ | ‘accent’ - Color state of the button. Default is ‘default’. It’s usually set to ‘accent’ when the model tree is open.
<hoops-toolbar-properties>
A button component with default icon that represents the properties panel.
Logic to toggle the visibility of the properties panel must be handled by the application with the default click
event.
Attributes:
color
- ‘default’ | ‘accent’ - Color state of the button. Default is ‘default’. It’s usually set to ‘accent’ when the properties panel is open.
<hoops-toolbar-snapshot>
A button component with default icon that represent the snapshot functionality.
Logic to trigger the snapshot must be handled by the application with the default click
event.
<hoops-toolbar-redlines>
A button component that provides a minimal UI to select the redlines operators through a dropdown menu.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
Pressing the Escape key will disable the redlines tool and go back to selection mode.
<hoops-toolbar-tools>
A button component with a default icon representing the tools panel.
Logic to toggle the visibility of the tools panel must be handled by the application with the default click
event.
Attributes:
color
- ‘default’ | ‘accent’ - Color state of the button. Default is ‘default’. It’s usually set to ‘accent’ when the tools panel is open.
<hoops-toolbar-views>
A button component with default icon that represents the views tree.
Logic to toggle the visibility of the views tree must be handled by the application with the default click
event.
Attributes:
color
- ‘default’ | ‘accent’ - Color state of the button. Default is ‘default’. It’s usually set to ‘accent’ when the views tree is open.
<hoops-tools-panel>
A panel that contains various sections for most of the operators management:
- selection
- measurements
- redlines
- markups
Each section can be instantiated separately, see:
<hoops-tools-select-group>
<hoops-tools-measurement-group>
<hoops-tools-redline-group>
<hoops-tools-markup-group>
More sections can be added as children of the hoops-tools-panel
component.
<hoops-tools-select-group>
A section component for the tools panel that provides buttons to enable various selection modes.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
<hoops-tools-measurement-group>
A section component for the tools panel that provides buttons to enable the different measurements operators.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
<hoops-tools-redline-group>
A section component for the tools panel that provides buttons to enable the different redlines operators.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
<hoops-tools-markup-group>
A section component for the tools panel that provides buttons to enable the different markup operators and display the markup list.
Link to the WebViewer
is internally established through the hoops-web-viewer-context-manager
.
UI Kit Tags
A modest yet essential UI-kit has been created to support the development of the Web Components library and the demo app. This kit includes basic but necessary elements to ensure a cohesive and functional user interface. It provides simple UI elements that are more elaborate than a button, including a layout with menus and panels for containers, and a tree generic enough for all components to use.
<hoops-accordion>
A collapsible component that allows you to group content in a way that can be expanded or collapsed.
The following slots are available to customize the accordion:
- ‘header’
- ‘toolbar’
- ‘icon’
- ‘content’
Attributes:
expanded
- boolean - Indicates whether the accordion is expanded.disabled
- boolean - Indicates whether the accordion is disabled.level
- number - The aria-level attribute for the heading element.
Events:
change
- Triggered when the accordion is expanded or collapsed.
<hoops-layout>
A comprehensive layout manager featuring top, down, right, and left panels, toolbars, a menu bar, a status bar, and a central widget. It provides a structured and organized interface for your application.
Use slot names to place the components in the desired location:
- ‘menu-bar’
- ‘status-bar’
- ‘panel-left’
- ‘panel-right’
- ‘panel-top’
- ‘panel-bottom’
- ‘toolbar-left’
- ‘toolbar-right’
- ‘toolbar-top’
- ‘toolbar-bottom’
- ‘central-widget’
Attributes:
floatingPanels
- boolean - If true, the panels will be displayed on top of the central widget.
<hoops-button>
A customizable button component that can have an icon in the “icon” slot and anything in the default slot. It can be used to trigger actions or navigate within your application.
Attributes:
tabindex
- number.role
- string - The role of the button, e.g., ‘button’, ‘menuitem’, etc.iconSize
- ‘sm’ | ‘md’ | ‘xl’ - Specifies the size of the icon. Default is ‘md’.color
- ‘default’ | ‘accent’ - Specifies the color state of the button. Default is ‘default’.disabled
- boolean - If true, the button will be disabled and not clickable. Default is false.
<hoops-dropdown>
A dropdown menu component that allows users to select from a list of options. It enhances the interactivity and usability of your application.
The dropdown button must be defined in the default slot. The dropdown content is defined in the “dropdown-popup” slot.
Attributes:
preventCloseOnClickInside
- boolean - If true, prevents the dropdown from closing when clicking inside it.position
- ‘bottom’ | ‘top’ | ‘right’ | ‘left’ - Specifies the position of the dropdown relative to the host element. Default is ‘bottom’.anchor
- ‘bottom’ | ‘top’ | ‘right’ | ‘left’ - Specifies the edge the dropdown is aligning to. Default is ‘left’.focusableSelector
- string - CSS selector for focusable elements. Default isa[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])
.disabled
- boolean - If true, the dropdown is disabled. Default is false.
<hoops-icon>
A web component that stores and manages all the icons used in your application. It ensures consistency and easy access to icons.
The list of available icons can be found in icons.ts
.
Attributes:
icon
- string - The name of the icon to be displayed.
<hoops-icon-button>
A button component that includes only an icon. It combines visual appeal with functionality, making it easy for users to understand its purpose.
Icon is defined in the default slot.
Attributes:
tabindex
- string - The tabindex of the button. Default is ‘0’.role
- string - The role of the button, e.g., ‘button’. Default is ‘button’.size
- string - The size of the icon. Default is ‘md’.color
- ‘default’ | ‘accent’ - The color state of the button. Default is ‘default’.disabled
- boolean - If true, the button is disabled. Default is false.
<hoops-list>
The hoops-list component is a generalist list view, controlled by the ListContext
. It is designed to display a list of items, allowing for selection and interaction.
Attributes:
The list hasn’t any attributes, but the List
class has the following properties to configure and interact with the list:
selected
- number[] - The list of selected item ids.list
- ContextWrapper - The list context wrapper that provides the data for the list. SeeListContext
for the context.
<hoops-node-properties>
A panel designed to display properties in a key-value format. It is useful for showing detailed information about selected items in your application.
Attributes:
nodeId
- number - The ID of the node whose properties will be displayed. This is typically the ID of the selected node.node
- INodePropertyAdapter - The node property adapter that provides the properties for the node. TheINodePropertyAdapter
has a model property to bind theWebViewer.model
.
<hoops-toolbar>
A basic vertical toolbar that allows you to stack buttons. It provides a convenient way to group and organize tools and actions.
Content of the toolbar is defined in the default slot.
<hoops-tree>
The hoops-tree component is a generalist tree view, controlled by the TreeContext
. It is designed to display elements as a tree, allowing for selection and interaction.
Attributes:
selected
- number[] - The list of selected item ids.tree
- ContextWrapper - The tree context wrapper that provides the data for the tree. SeeTreeContext
for the context.
<hoops-separator>
A separator component used to visually divide groups or elements. It helps in organizing visual items. Can be used in the toolbar or the dropdown for example.
Attributes:
direction
- ‘horizontal’ | ‘vertical’ - Specifies the orientation of the separator. Default is ‘horizontal’.
<hoops-switch>
A toggle switch component that allows users to switch between two states on/off.
Attributes:
checked
- boolean - The switch state.disabled
- boolean - Whether or not the switch is disabled.label
- string - The switch label.
Events:
change
- Triggered when the switch state changes.
React Adapters
The React adapters are designed to make possible the integration of our Web Components into React applications. They wrap the Web Components and handle event management, ensuring that the components work seamlessly within the React ecosystem.
ui-kit-react
: Will wrap components of the ui-kit
:
web-viewer-components-react
: Will wrap components of the web-viewer-components
: