---
title: "FollowTarget"
description: "A FollowTarget can be used to have an element follow a target such as an anchor or view."
type: "class"
lastmod: "2026-10-21"
---
## API Reference

> Source set: Android

```kotlin
public abstract class FollowTarget internal constructor(internal val mode: FollowMode)
```

A FollowTarget can be used to have an element follow a target such as an anchor or view.

## Members

### Companion

> Source set: Android

```kotlin
public companion object
```

## Functions

### view

> Source set: Android

```kotlin
public fun view(mode: FollowMode = FollowMode.soft()): FollowTarget
```

By designating content to follow the user's view, it will keep that content near the user
and typically within the field of view, even as the user moves around.

#### Parameters

| | |
| --- | --- |
| mode | determines how the trailing element follows the target. It can be made to move faster and be more responsive. The default is [FollowMode.soft()](/jetpack-compose/androidx.xr.compose/compose/classes/FollowMode). |

### anchor

> Source set: Android

```kotlin
public fun anchor(anchor: Anchor, mode: FollowMode = FollowMode.tight()): FollowTarget
```

Targeting an anchor allows content to be positioned relative to that anchor's location.

#### Parameters

| | |
| --- | --- |
| anchor | represents the anchor which the trailing element will be tethered to. As the anchor moves, so will the element. |
| mode | determines how the trailing element follows the target. It can be made to move faster and be more responsive. The default is [FollowMode.tight()](/jetpack-compose/androidx.xr.compose/compose/classes/FollowMode). |
