TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/toolwind/anchors/llms.txt
Use this file to discover all available pages before exploring further.
anchor/{name} utility sets the anchor-name CSS property on an element, registering it as a named anchor that other elements can position themselves relative to. Because anchor-name requires a dashed ident (a custom property–style name beginning with --), the plugin automatically converts plain names into dashed idents so you don’t have to type the -- prefix yourself.
Naming variants
There are four ways to pass a name toanchor/{name}. Each produces different CSS depending on whether you supply a plain name, an explicit dashed ident, an arbitrary value, or a CSS variable reference.
1. Non-dashed ident
Pass a plain name and the plugin prefixes it with--tw-anchor_ to satisfy the dashed-ident requirement.
my-anchor as the modifier.
2. Dashed ident
Prefix the name with-- to pass a dashed ident directly. The plugin uses it as-is, which is useful when you need to share the anchor name with hand-written CSS or another plugin.
3. Arbitrary value
Square-bracket arbitrary syntax lets you pass any value that is already a valid dashed ident.- Tailwind CSS v4
- Tailwind CSS v3
In v4,
anchor/[--my-anchor] passes the dashed ident directly — identical to the dashed-ident variant above.4. Variable shorthand syntax
Use this when the anchor name is stored in a CSS custom property and you want to reference it dynamically.- Tailwind CSS v4
- Tailwind CSS v3
In v4, wrap the variable name in parentheses to produce a
var() reference:anchor/(--x) and anchor/[var(--x)] are equivalent in v4 — both produce anchor-name: var(--x).anchor-scope/
Theanchor-scope/{name} utility follows the exact same naming rules as anchor/{name}, but sets the anchor-scope CSS property instead of anchor-name. Use it to limit anchor name lookup to a subtree, preventing name collisions in repeated components.
anchor-scope/{name}.
Summary
| Syntax | v4 output | v3 output |
|---|---|---|
anchor/my-anchor | anchor-name: --tw-anchor_my-anchor | anchor-name: --tw-anchor_my-anchor |
anchor/--my-anchor | anchor-name: --my-anchor | anchor-name: --my-anchor |
anchor/[--my-anchor] | anchor-name: --my-anchor | anchor-name: var(--my-anchor) |
anchor/(--x) | anchor-name: var(--x) | error |
anchor/[var(--x)] | anchor-name: var(--x) | anchor-name: var(--x) |
anchor/[--x] | anchor-name: --x | anchor-name: var(--x) |