Drawer with Snap Points
Snap points allow the drawer to rest at predefined heights, creating an iOS-like sheet experience. Perfect for content that works at multiple sizes.What This Example Shows
- Multiple snap positions (25%, 50%, 90% of screen height)
- Automatic snapping behavior on drag release
- Programmatic snap point control
- Callback for snap point changes
- Active snap point tracking
Code Example
How Snap Points Work
Value Range
Snap point values range from0 to 1, representing percentages of screen height:
0.25= 25% of screen height0.5= 50% of screen height0.9= 90% of screen height1.0= 100% of screen height
Behavior
- Automatic snapping: When you release the drawer while dragging, it automatically snaps to the nearest defined point
- Dismiss on over-drag: Dragging beyond the lowest snap point dismisses the drawer
- Smooth transitions: Animated transitions between snap points
Programmatic Control
Change Active Snap Point
Usebind:activeSnapPoint to control the drawer position:
React to Changes
Use theonSnapPointChange callback to respond to snap changes:
Common Use Cases
- Maps applications: Show location details at different heights
- Music players: Collapsed, half, and full screen views
- Product details: Preview at 30%, details at 60%, full specs at 90%
- Search results: Quick peek vs. full list view