Skip to content

API reference > @kontsedal/olas-core > createSelection

createSelection() function ​

Create a Selection<T>. Optional initial seeds the selected set.

handleClick encapsulates the standard click semantics: - plain click → select only id (anchor moves to id) - meta-click → toggle id. The anchor moves to id on add and stays on remove, so the row last clicked stays the anchor, as in a file manager. deselect(id) of the anchor clears it instead. - shift-click → range from anchor to id along ordered (anchor sticks, so subsequent shift-clicks extend from the same origin). With a Map, the range is the ids whose index lies between the two.

Spec §16.5.

Signature:

typescript
export declare function createSelection<T = unknown>(options?: {
  initial?: readonly string[];
}): Selection<T>;

Parameters ​

Parameter

Type

Description

options

{ initial?: readonly string[]; }

(Optional)

Returns:

Selection<T>

Released under the MIT License.