The CSS Anchor Positioning API is a native browser feature that lets you position any element relative to another element — called an anchor — without JavaScript. Before this API, building tooltips, dropdowns, popovers, and floating UI required either JavaScript layout calculations or complex CSS hacks.Documentation 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.
@toolwind/anchors brings this power directly into your Tailwind workflow as composable utility classes, so you can declare anchors and position elements against them entirely in HTML.
What is CSS anchor positioning?
CSS anchor positioning introduces two new concepts: an anchor element (any element assigned ananchor-name) and an anchored element (any element that uses position-anchor to link itself to an anchor). Once linked, the anchored element can be placed relative to any side of its anchor using position-area, or with explicit offsets using the anchor() function. You can also size anchored elements proportionally to their anchor using anchor-size().
This eliminates the need to track element positions in JavaScript for common UI patterns. The browser handles the geometry natively.
What this plugin provides
@toolwind/anchors maps the full CSS Anchor Positioning API to Tailwind utility classes. Instead of writing raw CSS, you apply classes directly in your markup:
anchor/{name}— assignsanchor-nameto an element, registering it as an anchoranchored/{name}andanchored-{position}/{name}— attaches an element to a named anchor and positions it usingposition-area{top|right|bottom|left}-anchor-{side}— explicit directional positioning using theanchor()function with optional theme-based offsetsw-anchor,h-anchor, and variants — size an anchored element usinganchor-size()anchored-visible-*— controls conditional visibility viaposition-visibilitytry-*andtry-order-*— defines fallback positions and ordering viaposition-try-fallbacksandposition-try-order
view-transition-name to every anchored element, so position changes can be animated with the View Transitions API.
Tailwind v3 and v4 compatibility
@toolwind/anchors supports both Tailwind CSS v3 (JS config) and Tailwind CSS v4 (CSS-first config). The installation steps differ slightly between versions, but the utility classes are the same across both. See installation for setup instructions for each version.
The CSS Anchor Positioning API is a browser feature. Check browser support before shipping to production.
Where to go next
Installation
Add
@toolwind/anchors to your project and configure it for Tailwind v3 or v4.Quickstart
Build a working tooltip in minutes using
anchor and anchored utilities.Utility index
Browse the complete reference for every utility class the plugin provides.
Advanced features
Use
anchor() and anchor-size() for precise offsets and proportional sizing.