Skip to content

API overview

The default export is the Glare class. Static helpers cover binding, opening, and looking up instances; methods on a returned instance control an open lightbox.

ts
import Glare from '@redot-src/glare'

Static methods

MethodWhat it does
Glare.bindAttach click handlers that open a gallery from markup.
Glare.autoBindBind every [data-glare] element once the DOM is ready.
Glare.openOpen a new instance from slides or elements and return it.
Glare.closeClose the topmost instance, or every instance when all is true.
Glare.getInstanceReturn the topmost open instance, or the one with the given id.
Glare.getInstancesReturn a copy of the open-instance stack.
Glare.destroyClose every instance and remove all bind() handlers.
Glare.defaultsMutable defaults object applied to instances created afterwards.

Reaching an instance

Glare.open() returns the instance directly. While a lightbox is open, read it again with Glare.getInstance() (topmost) or Glare.getInstance(id) using the data-glare-id on the container. Instance methods and properties are listed in Instance. Types live in TypeScript types.

Released under the MIT License.