Skip to content

withIndex JS

The withIndex decorator adds index navigation, boundary handling and index events to an existing js-toolkit component class. It is the decorator equivalent of the Indexable primitive.

Usage

ts
import { Base } from '@studiometa/js-toolkit';
import { withIndex } from '@studiometa/ui/withIndex';

class Paginated extends withIndex(Base) {
  get length() {
    return 10;
  }
}

See the Indexable usage guide and JS API for boundary modes, instructions, methods and events.