<!--
{
  "availability" : [
    "MapKit JS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/Map/selectedAnnotation",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "instp/mapkit.Map/selectedAnnotation"
  },
  "title" : "selectedAnnotation"
}
-->

# selectedAnnotation

The selected annotation.

```
get selectedAnnotation(): Annotation | null;
set selectedAnnotation(annotation: Annotation | null);
```

## Discussion

The value of [`selectedAnnotation`](/documentation/MapKitJS/Map/selectedAnnotation) is either a [`Annotation`](/documentation/MapKitJS/Annotation) object, if the user selects one, or `null` if there aren’t any selected annotations.

An annotation is in a selected state if its [`selected`](/documentation/MapKitJS/Annotation/selected) property is `true`. To deselect all annotations, set this property to `null`.

To select an annotation that’s already part of the map, set this property to the desired annotation.

When MapKit JS removes the selected annotation from the map (as an effect of [`removeAnnotation(annotation)`](/documentation/MapKitJS/Map/removeAnnotation), [`removeAnnotations(annotations)`](/documentation/MapKitJS/Map/removeAnnotations), or setting a new set of annotations with the [`annotations`](/documentation/MapKitJS/Map/annotations) property), MapKit JS deselects it before removing it.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)