parseAnchor

Commons
stable

Decompose a `TAnchor` string (e.g. `"top left"`, `"bottom"`, `"center"`) into a `{side, align}` pair used internally by overlay positioning utilities.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

anchor
requis
TAnchor
A TAnchor value: a single word (e.g. `"top"`, `"left"`, `"center"`) or two space-separated words (e.g. `"top left"`, `"bottom right"`). The first word is the side; the second (optional) word is the alignment.

API

Valeur de retour

La valeur retournée par cet util.

A `{ side, align }` object. When only one word is provided, `align` is inferred: block sides default to `"left"`, inline sides default to `"top"`, and `"center"` defaults to `"center"`.

Usage

Exemples

Extraits de code prêts à coller.

Parsing single and compound anchors

typescript