usePosition

Commons
stable

Derives CSS positioning classes and inline style declarations from IPositionProps. Emits a BEM modifier class for the position variant (absolute, fixed, sticky, relative, static) and inline top/bottom/left/right properties for any offset props that are set.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

Interfaces consommées

IPositionProps

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

props
requis
IPositionProps
Props containing `position` (CSS position keyword), `top`, `bottom`, `left`, `right` (CSS length values or token references).
name
string
getCurrentInstanceName()
Component name prefix used to build the BEM modifier class, e.g. "origam-btn" → "origam-btn--fixed".

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

positionClasses
BEM modifier class string when position is set (e.g. "origam-card--sticky"), undefined otherwise.
positionStyles
Array of inline CSS declarations for top / bottom / left / right. Only includes sides that have a non-falsy prop value.

Usage

Exemples

Extraits de code prêts à coller.

Sticky banner

vue

Floating action button

vue

Inside a custom component

vue