---
title: "missing-ref-attachment"
description: "Reports asContainer() or asAnchor() in a call that does not attach the ref."
image: "https://stillwind.dev/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://stillwind.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# missing-ref-attachment

This rule reports `asContainer()` or `asAnchor()` in a `style()` call that does not
also attach the ref. The container or anchor applies only to an element that has
the ref, so without it, nothing happens.

## Reported

```tsx
const card = style.ref("card");
style(card.asContainer("inline-size"));
```

> missing-ref-attachment: ref `card` provider has no matching marker attachment in this style() call
> 
> Example:2:7

## Fixed

```tsx
const card = style.ref("card");
style(card, card.asContainer("inline-size"));
```

## How to fix

Pass the ref and the method in the same `style()` call, as in the example.

`positionAnchor()` is not reported. The positioned element does not need the ref.

## Rule settings

| Preset | Severity |
| --- | --- |
| `recommended` | warn |
| `strict` | deny |
| `stylistic` | off |

[Configure lint](/docs/configuration#lint) to change the severity or options.

Source: https://stillwind.dev/docs/lints/missing-ref-attachment/index.mdx
