Overview
TheDrawerVariants component provides pre-styled drawer layouts for common use cases. It wraps DrawerContent with preset styles, saving you from writing boilerplate positioning and styling classes.
Props
Preset style variant to apply. Each variant has specific positioning, sizing, and styling.
Additional CSS classes to customize the variant. These classes are merged with the variant’s default styles.
Whether to trap keyboard focus inside the drawer. Passed through to the underlying
DrawerContent.Available Variants
default
Standard bottom drawer with gray background.
Styling:
- Background:
bg-gray-100 - Position:
fixed bottom-0 left-0 right-0 - Border radius:
rounded-t-[10px] - Top margin:
mt-24 - Height:
h-fit(auto-sized)
sheet
iOS-style bottom sheet with white background and large height.
Styling:
- Background:
bg-white - Position:
fixed bottom-0 left-0 right-0 - Border radius:
rounded-t-3xl(very rounded) - Height:
h-[85vh](85% of viewport) - Shadow:
shadow-2xl
dialog
Center-positioned modal dialog.
Styling:
- Background:
bg-white - Position:
fixed inset-0 m-auto - Border radius:
rounded-lg - Max width:
max-w-lg - Max height:
max-h-[90vh] - Height:
h-fit(auto-sized) - Shadow:
shadow-xl
minimal
Simple bottom drawer without extra styling.
Styling:
- Background:
bg-white - Position:
fixed bottom-0 left-0 right-0 - Height:
h-fit(auto-sized) - No border radius, no shadows
sidebar
Side navigation drawer with full height.
Styling:
- Background:
bg-white - Position:
fixed top-0 bottom-0 - Width:
w-full max-w-sm(full width, max 384px) - Height:
h-full - Shadow:
shadow-2xl
direction="left" or direction="right" on the Drawer component.
Usage Examples
Sheet Variant with Snap Points
Dialog Variant for Confirmations
Sidebar Variant for Navigation
Customizing Variants
Variant Comparison
| Variant | Position | Size | Use Case |
|---|---|---|---|
default | Bottom | Auto | General purpose, subtle |
sheet | Bottom | 85vh | iOS-style, full content |
dialog | Center | Auto, max 90vh | Confirmations, forms |
minimal | Bottom | Auto | Clean, unstyled |
sidebar | Left/Right | Full height | Navigation menus |
Relation to DrawerContent
DrawerVariants internally uses DrawerContent and passes through:
trapFocusprop- All other props (
...restProps) - Children content
class values.
Related Components
- DrawerContent - Underlying content container
- Drawer - Main wrapper component
- DrawerHandle - Visual drag indicator
- DrawerHeader - Optional header component
- DrawerFooter - Optional footer component