User Location@knitui/map
User Location
UserLocation renders the device's current position on the map. On web it adds a MapLibre GeolocateControl button to the top-right of the map; clicking it prompts the browser for geolocation permission and, once granted, centers on and marks your location. On native (iOS/Android) it renders the platform user-location indicator. Drop it as a child of <Map>.
import { UserLocation } from "@knitui/map";Playground
Loading playground…
<UserLocation />Examples
Default
The default user-location indicator. On web, look for the geolocate button in the top-right corner of the map — clicking it requests browser geolocation permission. Nothing appears until permission is granted.
Loading example…
Heading And Accuracy
With heading, accuracy, and animated enabled the indicator shows a heading cone and an accuracy ring, and updates smoothly. As with the default, web users must grant geolocation permission via the top-right control before anything shows.
Loading example…
Props
| Prop | Type | Default | Description |
|---|---|---|---|
accuracy | boolean | undefined | — | |
animated | boolean | undefined | — | |
children | ReactNode | — | |
heading | boolean | undefined | — | |
minDisplacement | number | undefined | — | |
onPress | (() => void) | undefined | — | |
testID | string | undefined | — |