UseFloating
Last updated: 3.0.0 (04/07/2024) | Added: 2.0.0
The useFloating()
hook provides a simple interface for generating CSS styles that respect the safe areas of a given device. It is used in the Floating Toolbar and all button components to provide float functionality.
Usage
The offset can also be customized far more:
useFloating
is also responsive, allowing you to define behavior for specific breakpoints:
Types
PositionHorizontal
PositionVertical
FloatingOffset
Props
positionHorizontal
"left"
The horizontal position of the element.
positionVertical
"top"
The vertical position of the element.
offset
20
How far from the edges this element is positioned.
calculateOffset
boolean
true
Whether to include safe areas (such as the notch and navigation cutouts in new iPhones) when calculating offsets.
Changelog
3.0.0: Added hook.
Last updated
Was this helpful?