Skip to main content

Item Hover

Overview​

The ItemHoverService keeps track of the hover state for all items in the tree. It exposes an observable to reactively track the currently hovered item.

Import​

import { DndModule } from 'ngx-builder-dnd';

Selector​

ItemHoverService

How it works​

The service automatically marks hoverable elements with the data-ngx-item-hover attribute. Directives like DropListDirective use this attribute to locate the currently hovered item.


API Reference​

Observables​

NameDescription
_hoveredItem$: BehaviorSubject<HTMLElement | null>Internal subject holding the currently hovered element.

Properties​

NameDescription
ITEM_HOVER_ATTR: stringThe attribute used to mark hoverable builder item elements.

Methods​

NameParametersReturnsDescription
hovered$-Observable<HTMLElement | null>Observable emitting the currently hovered item.
setHoveredItemitemElement: HTMLElement | nullvoidSets the currently hovered item.
hoveredElement-HTMLElement | nullGetter/setter for the currently hovered element.

See Also​