# FeatureSelectionState

What [`useFeatureSelection`](https://docs.mapcairn.com/api/map/useFeatureSelection.md) returns: the selected set as the ui shows it, and every action on it.

This is an interface exported by `@mapcairn/map`, checked against version 0.2.0.

## Signature

```ts
import type { FeatureSelectionState } from "@mapcairn/map";
 
interface FeatureSelectionState
```

## Properties

### entries

```ts
readonly entries: readonly SelectedEntry[];
```

The selected references in selection order, each resolved against the layers (see [`SelectedEntry`](https://docs.mapcairn.com/api/map/SelectedEntry.md)).

### limit

```ts
readonly limit: number;
```

The most references the store holds.

### selecting

```ts
readonly selecting: boolean;
```

Whether select mode is on. It is only a flag: nothing here reads it.

## Methods

### add

```ts
add(refs: readonly FeatureRef[]): void;
```

Selects the references that are not yet selected and belong to a feed
layer. The store refuses the whole batch when it would pass its limit.

- `refs` (`readonly FeatureRef[]`)

### clear

```ts
clear(): void;
```

Empties the selection.

### remove

```ts
remove(refs: readonly FeatureRef[]): void;
```

Deselects the references that are selected. Always allowed.

- `refs` (`readonly FeatureRef[]`)

### setSelecting

```ts
setSelecting(selecting: boolean): void;
```

Turns select mode on or off.

- `selecting` (`boolean`)

### toggle

```ts
toggle(ref: FeatureRef): void;
```

Selects the feature, or deselects it when it is selected.

- `ref` (`FeatureRef`)

## See also

- [`FeatureRef`](https://docs.mapcairn.com/api/core/FeatureRef.md)
- [`SelectedEntry`](https://docs.mapcairn.com/api/map/SelectedEntry.md)

Source: [packages/map/src/layers/useFeatureSelection.ts:69](https://github.com/MapCairn/mapcairn/blob/main/packages/map/src/layers/useFeatureSelection.ts#L69)
