defmodule PyrauiWeb.DocsLive.DrawerDocs do use PyrauiWeb, :html def render(assigns) do assigns = assigns |> assign(:drawer_open_state, Map.get(assigns, :"drawer-docs_open", false)) |> assign(:drawer_open_state_right, Map.get(assigns, :"drawer-docs-right_open", false)) ~H"""
Off-canvas surfaces for navigation, filters, and contextual actions. Switch sides, toggle overlays, and nest secondary actions without rebuilding the shell.
Slide from the left with an overlay. Perfect for navigation menus or project switchers.
Combine trigger slots with tinted overlays so the drawer reads as a premium command palette. Clicking outside or pressing Esc closes it instantly.
Navigation
<.drawer id="nav-drawer" open={@drawer_open_state} side={:left} overlay={true}>
<:trigger>
<span class="inline-flex items-center gap-2 rounded-xl bg-blue-600 px-5 py-2 text-sm font-semibold text-white">
<.icon name="hero-bars-3" class="h-4 w-4" />
Open Drawer
</span>
</:trigger>
<:content>
<nav class="space-y-2">
...
</nav>
</:content>
</.drawer>
Slide from the right without an overlay. Perfect for staying co-visible with the page.
Disable the overlay so the drawer feels like part of the canvas. Use background blur or border accents to distinguish from the underlying content.
Filters
<.drawer id="filters-drawer" open={@filters_open?} side={:right} overlay={false}>
<:trigger>
<span class="rounded-lg border border-emerald-200 px-4 py-2 text-sm font-semibold text-emerald-600">
Open Filters
</span>
</:trigger>
<:content>
...
</:content>
</.drawer>
| Prop | Type | Default | Description |
|---|---|---|---|
| side | :left | :right | :left | Drawer origin. Right-hand drawers pair well with filters or inspector panels. |
| overlay | boolean | true | Add a dimming layer behind the drawer. Set to false when you want split views. |
| class | string | "" | Extend styling—rounded corners, borders, or custom widths. |
| trigger | slot | [] | Optional slot; when omitted, manage the drawer with your own actions (phx-click). |