Overview
TheDrawerHandle component renders a visual drag indicator (handle bar) that helps users understand the drawer can be dragged. It automatically adapts its orientation based on the drawer’s direction.
Props
CSS classes for customizing the handle’s appearance. Can override default colors, size, or spacing.
Auto-Adaptive Orientation
The handle automatically adjusts its orientation based on the drawer’sdirection:
Bottom/Top Drawers (horizontal handle):
- Width:
12px(w-12 / 3rem) - Height:
1.5px(h-1.5 / 0.375rem) - Centered horizontally with
mx-auto
- Width:
1.5px(w-1.5 / 0.375rem) - Height:
12px(h-12 / 3rem) - Centered vertically with
my-auto
Usage Examples
Bottom Drawer
Side Drawer
Custom Styling
All Drawer Directions
Default Styling
The handle comes with sensible defaults:rounded-full- Fully rounded cornersbg-gray-300- Gray background colorflex-shrink-0- Prevents shrinking in flex containerscursor-grab- Indicates draggable areaactive:cursor-grabbing- Shows grabbing state when clicked
Drag Functionality
The handle includes thedata-drawer-drag attribute, which:
- Marks it as a drag zone: Always draggable, even if placed within interactive elements
- Improves touch targeting: Provides a clear area for mobile users to grab
- Visual affordance: Indicates to users that the drawer can be dragged
Accessibility
The component includes:aria-hidden="true"- Hidden from screen readers (decorative element)role="presentation"- Indicates the element is presentational
DrawerContent.
When to Use
UseDrawerHandle when:
- You want a clear visual indicator that the drawer is draggable
- Following mobile design patterns (iOS-style sheets)
- Creating touch-friendly interfaces
- You have interactive content and want a dedicated drag area
- Creating minimal designs
- Building desktop-only experiences
- Using pre-styled
DrawerVariants(some variants exclude handles)
Common Patterns
With Header
With DrawerHeader Component
In Variants
Related Components
- DrawerContent - Content container with drag handling
- Drawer - Main wrapper component
- DrawerVariants - Pre-styled drawer variants