Skip to content

API reference > @kontsedal/olas-core > Selection_2

Selection_2 type ​

Multi-select state for tables / lists with bulk actions (spec §16.5).

Plain function — not bound to ctx. Place it in a controller's closure so it dies with the closure. The phantom T parameter brands the selection by item type; IDs are always strings.

Signature:

typescript
type Selection<T = unknown> = {
  selectedIds: ReadSignal<ReadonlySet<string>>;
  size: ReadSignal<number>;
  isSelected(id: string): ReadSignal<boolean>;
  select(id: string): void;
  deselect(id: string): void;
  toggle(id: string): void;
  clear(): void;
  selectAll(ids: readonly string[]): void;
  handleClick(id: string, mods: {
    shift?: boolean;
    meta?: boolean;
  }, ordered: readonly string[] | ReadonlyMap<string, number>): void;
};

References: ReadSignal

Released under the MIT License.