---
title: AnnotationLayerOptions
summary: Interface in @bimworks/viewercommon.
order: 10
languages: [javascript]
sdk-package: JavaScript · @bimworks/viewercommon
---

# AnnotationLayerOptions

[[page:reference/javascript/api|API catalogue]] · `@bimworks/viewercommon` · Interface

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
interface AnnotationLayerOptions<D>
````



### Type parameters

| Name | Constraint | Description |
|---|---|---|
| `D` | `` |  |

## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-align-348729353995|align]] | Property | Which side of the anchor the compact box is drawn on, as Annotation.align; default the template's origin |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-anchor-ec65f97e7173|anchor]] | Property | Where on the object: a point of its box in its model's axes as Annotation.anchor (default the template's, else "center"), or a function of its bounds in view… |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-clustering-1f5c6bfdbd47|clustering]] | Property | Whether overlapping annotations of the layer merge into one with a count; default true |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-dotbeyondmm-28baff5411ac|dotBeyondMm]] | Property | Beyond this distance a row is a 10 px dot in its status colour with its label as the title, and the template is not called; hovered, it shows the template. I… |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-expand-fd24e7cce2ba|expand]] | Property | When an expandable template's card shows: "hover" (after 250 ms; a click, tap or Enter pins it), "click", or "none". Default: "none" for a layer shown only o… |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-filter-a6a50721ca44|filter]] | Property |  |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-group-0ac4d6627370|group]] | Property | Annotation group name; default "layer:" + template name + a counter |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-join-4b237c38b9a5|join]] | Property | With a query: "query" (default) shows only objects the query returned, "union" also application rows it did not |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-key-29939eeb94be|key]] | Property | What identifies a row: the object's qid (default), or its IFC GlobalId for data from outside. With a query the layer gets attribute.GlobalId and joins on it … |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-limit-6eace539e191|limit]] | Property | At most this many annotations of the layer show, the nearest (Annotation.groupLimit) |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-maxdistancemm-2dc1b1edb469|maxDistanceMm]] | Property |  |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-occlusion-5a7faac5a28e|occlusion]] | Property | As Annotation.occlusion; default "hide" |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-onaction-057836c0c1e3|onAction]] | Property | A click on an element with data-action="" inside an annotation |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-onclick-2b69f97effab|onClick]] | Property | A click on an annotation, or Enter/Space on it; makes the annotations focusable buttons |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-query-b41ae96d4a9e|query]] | Property | Data from BQL, fetched in one batch on the loaded models (and on models loaded later). A string is sent as it is and its data keeps the records' shape (d.att… |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-rows-62c78746bc67|rows]] | Property | Data from the application, joined to the query's rows by key (the application's fields win) |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-scalebydistance-3e93533090e9|scaleByDistance]] | Property |  |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-template-f6c8cfb9c8ea|template]] | Property | The template, or the name it is registered under |
| [[page:reference/javascript/bimworks-viewercommon/annotationlayeroptions-06f700d3#member-visibility-61d66817337e|visibility]] | Property | "hover": shown only while its object is hovered, fading in after a moment and out quickly. Without onClick, onAction or a card (expand), the pointer goes thr… |

## `align` {#member-align-348729353995}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
align?: AnnotationAlign | null
````

Which side of the anchor the compact box is drawn on, as `Annotation.align`; default the template's origin

## `anchor` {#member-anchor-ec65f97e7173}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
anchor?: string | (bounds: { max: (number)[]; min: (number)[] }, row: AnnotationRow<D>) => (number)[]
````

Where on the object: a point of its box in its model's axes as `Annotation.anchor` (default the
template's, else "center"), or a function of its bounds in viewer coordinates

## `clustering` {#member-clustering-1f5c6bfdbd47}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
clustering?: boolean
````

Whether overlapping annotations of the layer merge into one with a count; default true

## `dotBeyondMm` {#member-dotbeyondmm-28baff5411ac}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
dotBeyondMm?: number | null
````

Beyond this distance a row is a 10 px dot in its status colour with its label as the title, and the template is not
called; hovered, it shows the template. It turns back nearer than 90 % of the distance. Default: never

## `expand` {#member-expand-fd24e7cce2ba}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
expand?: "none" | "click" | "hover"
````

When an expandable template's card shows: "hover" (after 250 ms; a click, tap or Enter pins it), "click", or
"none". Default: "none" for a layer shown only on hover (visibility "hover"), else the template's default, else
"hover"

## `filter` {#member-filter-a6a50721ca44}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
filter?: (row: AnnotationRow<D>) => boolean
````



## `group` {#member-group-0ac4d6627370}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
group?: string
````

Annotation group name; default "layer:" + template name + a counter

## `join` {#member-join-4b237c38b9a5}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
join?: "query" | "union"
````

With a query: "query" (default) shows only objects the query returned, "union" also application rows it did not

## `key` {#member-key-29939eeb94be}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
key?: "qid" | "globalId"
````

What identifies a row: the object's qid (default), or its IFC GlobalId for data from outside. With a query the
layer gets attribute.GlobalId and joins on it (a string query returns it as a globalId column); without one it finds
the GlobalIds' objects in one query, and again for GlobalIds it has not seen and for models loaded later

## `limit` {#member-limit-6eace539e191}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
limit?: number | null
````

At most this many annotations of the layer show, the nearest (Annotation.groupLimit)

## `maxDistanceMm` {#member-maxdistancemm-2dc1b1edb469}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
maxDistanceMm?: number
````



## `occlusion` {#member-occlusion-5a7faac5a28e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
occlusion?: "none" | "hide" | "dim"
````

As Annotation.occlusion; default "hide"

## `onAction` {#member-onaction-057836c0c1e3}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
onAction?: (action: string, row: AnnotationRow<D>, event: Event) => void
````

A click on an element with data-action="<name>" inside an annotation

## `onClick` {#member-onclick-2b69f97effab}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
onClick?: (row: AnnotationRow<D>, event: Event) => void
````

A click on an annotation, or Enter/Space on it; makes the annotations focusable buttons

## `query` {#member-query-b41ae96d4a9e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
query?: string | { get?: Record<string, string>; models?: (string)[]; parameters?: Record<string, unknown>; where?: string }
````

Data from BQL, fetched in one batch on the loaded models (and on models loaded later). A string is sent as it
is and its data keeps the records' shape (d.attribute.Name); {where, get} asks for the template's fields and
get's as their keys: GET qid, type, <field> AS …, … WHERE <where>

## `rows` {#member-rows-62c78746bc67}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
rows?: Iterable<AnnotationRow<Partial<D>>, any, any>
````

Data from the application, joined to the query's rows by key (the application's fields win)

## `scaleByDistance` {#member-scalebydistance-3e93533090e9}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
scaleByDistance?: boolean | null
````



## `template` {#member-template-f6c8cfb9c8ea}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
template: string | AnnotationTemplate<D>
````

The template, or the name it is registered under

## `visibility` {#member-visibility-61d66817337e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
visibility?: "always" | "hover"
````

"hover": shown only while its object is hovered, fading in after a moment and out quickly. Without onClick,
onAction or a card (expand), the pointer goes through it to the objects below, and Viewer3D draws it beside its
object's footprint on screen
