useDimension
Commons
stable
Resolves the six dimension props (width, height, minWidth, maxWidth, minHeight, maxHeight) into inline CSS declarations. Numbers become `px` values, strings pass through (supports CSS lengths, custom properties and aspect-ratio shortcuts).
API
Signature
Signature TypeScript complète extraite du fichier du composable.
Always extend IDimensionProps rather than declaring width/height manually. A hand-rolled height-only prop silently ignores maxHeight, minHeight, etc.
Interfaces consommées
IDimensionProps
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisIDimensionProps
- Component props extending IDimensionProps. Reads width, height, minWidth, maxWidth, minHeight, maxHeight.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- dimensionStyles
- Inline CSS declarations for all provided dimension props, e.g. ["width: 200px", "max-height: 50vh"].
Usage
Exemples
Extraits de code prêts à coller.
Basic usage
With CSS custom properties