Every time you useDocumentation 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.
anchored/{name} to attach a floating element to a named anchor, the plugin automatically assigns a view-transition-name to that element. This means you can animate position changes — such as moving a tooltip from one side of an anchor to another — using the browser-native View Transitions API without any additional configuration or animation library.
This feature uses the View Transitions API, a browser-native web platform feature. It is not a custom animation system provided by this plugin.
How it works
When you writeanchored/my-btn, the plugin generates the following CSS:
view-transition-name value is derived by encoding the anchor name using a base-36 character code scheme. The encoding is deterministic — the same anchor name always produces the same view-transition-name — so it remains stable across re-renders and server-rendered pages.
The view-transition-name is set inside a :where() selector, which has zero specificity. This means any explicit view-transition-name you set yourself will always take precedence.
Triggering a position change
Wrap a class change insidedocument.startViewTransition() to animate the element moving from one position to another:
::view-transition-old and ::view-transition-new CSS pseudo-elements.
Opting out
If you do not want aview-transition-name applied to a particular anchored element, add the Tailwind arbitrary property utility [view-transition-name:none] to the element’s class list:
view-transition-name is set at zero specificity via :where(), the arbitrary utility overrides it without needing !important.
Name encoding
The encoded suffix in--tw-anchor-view-transition-{encoded} is produced by converting each character of the anchor name to its base-36 character code and concatenating the results. For example, the anchor name my-btn produces a consistent encoded string each time.
This approach keeps view-transition names unique per anchor while avoiding CSS ident restrictions on special characters.
Combining with fallback positioning
When using View Transitions alongside fallback positioning, the browser animates the element even when it transitions between fallback positions. Addtry-* utilities to ensure the element repositions gracefully before the animation runs:
try-* utilities.
Related
Fallback positioning
Prevent overflow before animating with position-try fallbacks.
anchored utility
How anchored/ works and what CSS it generates.