Skip to main content

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.

This page is a quick reference for all utility classes provided by the @toolwind/anchors plugin. Each section covers a distinct area of the CSS Anchor Positioning API. For deeper explanations, follow the links to the relevant guide pages.

Anchor definition

These utilities assign an anchor-name to an element, making it a named anchor that other elements can position themselves relative to.
ClassCSS outputNotes
anchor/{name}anchor-name: --tw-anchor_{name}Auto-prefixes plain idents with --tw-anchor_
anchor/--{name}anchor-name: --{name}Preserves dashed ident as-is
anchor-scope/{name}anchor-scope: --tw-anchor_{name}Scopes anchor name to a subtree
anchor-scope/--{name}anchor-scope: --{name}Scopes using a dashed ident directly
<!-- plain ident — auto-prefixed -->
<div class="anchor/my-tooltip-trigger"></div>

<!-- dashed ident — used as-is -->
<div class="anchor/--my-tooltip-trigger"></div>
See Anchor Name for a full explanation of naming conventions, variable shorthand syntax, and v3/v4 differences.

Anchoring and positioning

These utilities attach a floating element to a named anchor and optionally set its position area. When a name modifier is present, the utility also sets position: absolute and view-transition-name (inside a :where() block for easy override).
ClassCSS output
anchored/{name}position-anchor, position: absolute, view-transition-name
anchored-{position}position-area: {position}
anchored-{position}/{name}position-anchor + position-area + absolute positioning
<!-- attach only -->
<div class="anchored/my-btn"></div>

<!-- position only (assumes position-anchor is set elsewhere) -->
<div class="anchored-top-center"></div>

<!-- attach and position in one class -->
<div class="anchored-top-center/my-btn"></div>
See Anchored for details on the :where() specificity pattern and how to override position or view-transition-name.

Position area values

All 20 supported position-area values map to the following utility suffixes:
Utility suffixCSS value
top-centertop center
top-span-lefttop span-left
top-span-righttop span-right
toptop
left-centerleft center
left-span-topleft span-top
left-span-bottomleft span-bottom
leftleft
right-centerright center
right-span-topright span-top
right-span-bottomright span-bottom
rightright
bottom-centerbottom center
bottom-span-leftbottom span-left
bottom-span-rightbottom span-right
bottombottom
top-lefttop left
top-righttop right
bottom-leftbottom left
bottom-rightbottom right
See Position Area for a visual guide to each value.

Directional positioning with anchor()

These utilities generate explicit top, right, bottom, left, or inset values using the anchor() CSS function. An optional Tailwind spacing offset wraps the result in calc(). Pattern: {property}-anchor-{side} or {property}-anchor-{side}-{offset}/{name?}
  • {property}top, right, bottom, left, or inset
  • {side}top, right, bottom, left, start, end, self-start, self-end, center
  • {offset} — any Tailwind spacing value (e.g. 41rem)
  • /{name} — optional anchor name modifier
Example classCSS output
top-anchor-bottomtop: anchor(bottom)
top-anchor-bottom-4top: calc(anchor(bottom) + 1rem)
left-anchor-rightleft: anchor(right)
bottom-anchor-top-2bottom: calc(anchor(top) + 0.5rem)
top-anchor-bottom/my-nametop: anchor(--tw-anchor_my-name bottom)
inset-anchor-centerinset: anchor(center)
<!-- position tooltip 1rem below anchor's bottom edge -->
<div class="top-anchor-bottom-4/my-btn"></div>
See anchor() Functions for a full reference including negative offsets.

Anchor-center alignment

These utilities set the corresponding CSS alignment property to anchor-center, which centers a floating element on its anchor’s main axis.
ClassCSS property set
justify-self-anchorjustify-self: anchor-center
self-anchoralign-self: anchor-center
justify-items-anchorjustify-items: anchor-center
items-anchoralign-items: anchor-center
place-items-anchorplace-items: anchor-center
place-self-anchorplace-self: anchor-center

Sizing with anchor-size()

These utilities set width, height, or min/max dimension properties using the anchor-size() CSS function. An optional spacing offset wraps the result in calc(). Pattern: {abbr}-anchor or {abbr}-anchor-{size} or {abbr}-anchor/{name}
  • {abbr}w, h, min-w, min-h, max-w, max-h
  • {size}width, height, block, inline, self-block, self-inline
  • /{name} — optional anchor name modifier
Example classCSS output
w-anchorwidth: anchor-size(width)
h-anchorheight: anchor-size(height)
w-anchor-heightwidth: anchor-size(height)
h-anchor-inlineheight: anchor-size(inline)
min-w-anchormin-width: anchor-size(width)
max-h-anchor-blockmax-height: anchor-size(block)
w-anchor/my-namewidth: anchor-size(--tw-anchor_my-name width)
w-anchor-height/--my-namewidth: anchor-size(--my-name height)
<!-- make a popover the same width as its anchor button -->
<div class="w-anchor/my-btn anchored/my-btn anchored-bottom"></div>
See anchor-size() Sizing for offset usage and additional examples.

Position visibility

Controls when an anchored element is rendered visible using position-visibility.
ClassCSS output
anchored-visible-alwaysposition-visibility: always
anchored-visible-anchorposition-visibility: anchors-visible
anchored-visible-no-overflowposition-visibility: no-overflow
anchored-visible-[{value}]position-visibility: {value} (arbitrary)
See Position Visibility for behavior details.

Position try fallbacks

These utilities configure fallback positioning strategies when the primary position overflows the viewport.

try-order-*position-try-order

ClassCSS output
try-order-normalposition-try-order: normal
try-order-wposition-try-order: most-width
try-order-hposition-try-order: most-height

try-*position-try-fallbacks

ClassCSS output
try-noneposition-try-fallbacks: none
try-flip-allposition-try-fallbacks: flip-block, flip-inline, flip-block flip-inline
try-flip-xposition-try-fallbacks: flip-inline
try-flip-yposition-try-fallbacks: flip-block
try-flip-sposition-try-fallbacks: flip-start
try-{position-area}position-try-fallbacks: {position-area value}
try-[{value}]position-try-fallbacks: {value} (arbitrary)
All 20 position area values are valid as try- suffixes. Examples: try-top, try-bottom-left, try-right-span-top.
See Position Try for how to combine multiple fallback values.

Build docs developers (and LLMs) love