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.
Interfaces consommées
IPositionProps
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisIPositionProps
- Props containing `position` (CSS position keyword), `top`, `bottom`, `left`, `right` (CSS length values or token references).
- namestringgetCurrentInstanceName()
- 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
Floating action button
Inside a custom component