Tesserae

VisibilitySensor

Description

A component that fires an action when it scrolls into the viewport. Useful for triggering lazy loading, telemetry, infinite-scroll pagination, or any "do once when visible" behaviour. By default the callback fires only once; set singleCall: false to receive every visibility transition.

Usage

API reference

class

VisibilitySensor

public class VisibilitySensor : IComponent

A VisibilitySensor component that triggers an action when it becomes visible in the viewport.

Constructors

Constructor
VisibilitySensor
public VisibilitySensor(Action<VisibilitySensor> onVisible, bool singleCall = true, IComponent message = null)

Initializes a new instance of the VisibilitySensor class.

Parameters

onVisible
The action to perform when the sensor becomes visible.
singleCall
Whether to trigger the action only once.
message
An optional component to display as the content of the sensor.

Methods

Method
VisibilitySensor.Render
public HTMLElement Render()

Renders the visibility sensor.

Returns

The rendered HTMLElement.

Method
VisibilitySensor.Reset
public void Reset()

Resets the sensor so it can trigger the action again.

See also

© 2026 Tesserae. All rights reserved.