---
title: Link target
description: Display a related value as a link to another Backlit view.
---

A link target attaches navigation to a field value or a table row. It does not
own the content that it decorates. A field can keep any display variant and also
have a link.

## API

```ts
linkTo(
  view: Linkable | (() => Linkable),
  args?: unknown[] | ((row) => unknown[]),
  options?: {
    mode?: 'page' | 'modal' | 'drawer'
    filters?: GetFiltersFor<View> | ((row) => GetFiltersFor<View>)
  }
): LinkTarget
```

`args` must match the target view parameters in length and order. A view with no
parameters does not need args. Missing args are an authoring error.

`filters` sets the state the target view opens with. The keys are the filter
names the view registers at the view scope, and each value is that filter's
parsed value, the value `ctx.parse` gives the resolver. TypeScript reads both
from the view definition. Pass a function to read the filters from the record.

```ts
linkTo(() => dealList, [], { filters: (row) => ({ stage: [row.stage] }) })
```

A link in `modal` or `drawer` mode carries its filters too. The dialog opens
with them in its own URL.

## Basic link target

Pass the target view and read its args from the record that the field uses.

<BacklitExample path="targets/link/basic" view="detail" />

## Thunk

Pass a function when two resource modules refer to each other. Backlit reads
the view when it creates the protocol node, after both modules are initialized.

<BacklitExample path="targets/link/thunk" view="detail" />

## Args from the record

Use an args callback when the target view needs values from the current record.

<BacklitExample path="targets/link/mapped_params" view="detail" />

Use `visitTo` instead when the target must define a standalone control with its
own text, icon, tooltip, or `skip` state.
