Drawer

FodDrawer provides responsive navigation panels that slide from any viewport edge. Supports modal and non-modal flows, multiple variants (Temporary, Persistent, Permanent), and keeps focus management plus scroll locking compliant with WCAG requirements.

Basic Example

Temporary drawers cover the content and use a scrim. Click the button to open the drawer, then press Esc or the close button.

Click to open temporary drawer

razor
<FodDrawer Open="@_open"
           OpenChanged="@(value => _open = value)"
           Anchor="DrawerAnchor.Left"
           Variant="DrawerVariant.Temporary">
    <Header>
        <div>Workspace</div>
    </Header>
    <ChildContent>
        <p>Drawer content here</p>
    </ChildContent>
    <Footer>
        <FodButton OnClick="@(() => _open = false)">Close</FodButton>
    </Footer>
</FodDrawer>

Drawer Variants

FodDrawer supports three variants: Temporary (modal with scrim), Persistent (collapsible sidebar), and Permanent (always visible).

Temporary

Covers content with a scrim. Ideal for mobile or focused tasks.

Persistent

Sits alongside content and can collapse without a scrim.

Permanent

Always visible, typically paired with app bars.

razor
<FodDrawer Variant="DrawerVariant.Temporary">...</FodDrawer>
<FodDrawer Variant="DrawerVariant.Persistent">...</FodDrawer>
<FodDrawer Variant="DrawerVariant.Permanent">...</FodDrawer>

Drawer States

Configure drawer behavior with backdrop, scroll lock, and escape key handling options.

Configuration Options

Test Configuration

razor
<FodDrawer CloseOnEscape="true"
           DisableBackdrop="false"
           DisableScrollLock="false">
    ...
</FodDrawer>

Persistent Drawer with Container

Use FodDrawerContainer for persistent drawers that push content. The drawer stays fixed while scrolling, with its own internal scroll for navigation items.

Main Content Area

This content scrolls with the page. The drawer remains fixed on the left side.

Content Section 1

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 2

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 3

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 4

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 5

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 6

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 7

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

Content Section 8

Sample content section demonstrating scroll behavior. Notice how the drawer stays fixed.

razor
<FodDrawerContainer>
    <FodDrawer @bind-Open="_open"
               Variant="DrawerVariant.Persistent"
               Width="240px">
        <!-- Drawer content -->
    </FodDrawer>
    <FodDrawerContent>
        <!-- Main content -->
    </FodDrawerContent>
</FodDrawerContainer>

Mini Drawer

Mini drawers reduce to icon-only rails until expanded, perfect for dense dashboards.

Collapse the drawer to show just the icon rail, expand to reveal labels.

razor
<FodDrawer EnableMini="true"
           MiniWidth="72px"
           Width="200px">
    <ChildContent>Full content</ChildContent>
    <MiniContent>Icon-only content</MiniContent>
</FodDrawer>

All Anchor Positions

Drawers can slide from any edge of the viewport. Click each button to see the drawer appear from that direction.

Left

Most common for navigation

Right

Filters, details panels

Top

Notifications, secondary nav

Bottom

Mobile actions, sheets

razor
<FodDrawer Anchor="DrawerAnchor.Left">...</FodDrawer>
<FodDrawer Anchor="DrawerAnchor.Right">...</FodDrawer>
<FodDrawer Anchor="DrawerAnchor.Top" Height="40vh">...</FodDrawer>
<FodDrawer Anchor="DrawerAnchor.Bottom" Height="40vh">...</FodDrawer>

Animation Callbacks

Hook into drawer lifecycle events to coordinate animations, analytics, or state changes.

Event Log:
No events yet - open the drawer to see callbacks
razor
<FodDrawer OnOpening="HandleOpening"
           OnOpened="HandleOpened"
           OnClosing="HandleClosing"
           OnClosed="HandleClosed">
    ...
</FodDrawer>

Swipe to Close (Mobile)

On touch devices, temporary drawers can be closed with swipe gestures. Try it on mobile or use browser dev tools touch emulation.

Swipe threshold:
px
razor
<FodDrawer EnableSwipeToClose="true"
           SwipeThreshold="50">
    ...
</FodDrawer>

RTL (Right-to-Left) Support

Drawers automatically adapt to RTL layouts. Left/right anchors are mirrored, and spacing respects text direction.

Current direction: LTR (Left-to-Right)

In LTR mode, drawers behave normally with left/right anchors as expected.

razor
<div dir="rtl">
    <FodDrawer Anchor="DrawerAnchor.Left">
        <!-- Appears on right in RTL mode -->
    </FodDrawer>
</div>

Playground

Configure anchors, variants, overlay behavior, and mini mode to see how the drawer responds in real time.

Configuration

Preview

Click the backdrop or ESC (when enabled) to close.

razor
<FodDrawer Variant="@variant"
           Anchor="@anchor"
           Width="320px"
           EnableMini="true"
           Modal="true">
    ...
</FodDrawer>

Accessibility

FodDrawer follows WCAG guidelines with proper ARIA roles, keyboard support, and focus management.

ARIA Roles

Temporary drawers use role="dialog" with aria-modal="true". Persistent/permanent drawers announce as complementary regions.

Keyboard Support

Focus moves inside when opened, Tab/Shift+Tab are trapped in modal mode, Esc closes when enabled, and focus returns to the trigger.

Screen Readers

Provide a descriptive header element so screen readers announce the purpose of the drawer immediately.

Best Practices

Guidelines for effective drawer usage.

  • Use temporary drawers for task-focused flows or small screens
  • Use persistent/permanent drawers to expose core navigation on tablet/desktop
  • Keep drawer content scannable: group links, add dividers, and limit custom actions
  • Always provide a clear way to close the drawer (button, backdrop click, or ESC key)
  • Use mini mode for dense dashboards where icon recognition is sufficient
  • Test drawer behavior in both LTR and RTL layouts

API Reference - Parameters

FodDrawer component parameters and their descriptions.

No properties defined.

API Reference - Events

FodDrawer component events for lifecycle and interaction handling.

No properties defined.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.