Drawers
Panels that slide in from an edge: placement, sizes and a filters form, with the dialog behaviour of the page.
Basic
A panel that slides in from the edge and covers the page with a backdrop. It has the same behaviour as a modal: button-text or button-icon renders the button, or one of your own goes in the button slot with aria-haspopup="dialog" and aria-controls (<id>-panel; button-class adds classes to the default button), the popup script makes the panel a modal dialog while it is open, traps Tab, closes on Esc or a click on the backdrop and returns the focus to the button. A button inside the panel with the same aria-controls closes it. The header names the dialog with aria-labelledby.
Product details
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Discard this draft?
The draft and its photos will be removed. You cannot undo this.
<div id="drawer-basic" class="inline-flex">
<button
id="button-1559"
type="button"
aria-controls="drawer-basic-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 in-[.button-group-subtle]:bg-primary-100 in-[.button-group-subtle]:text-primary-800 in-[.button-group-subtle]:not-disabled:hover:bg-primary-200 in-[.button-group-subtle]:not-disabled:active:bg-primary-300 in-[.button-group-subtle]:focus-visible:ring-primary-700 in-[.button-group-subtle]:dark:bg-primary-900/50 in-[.button-group-subtle]:dark:text-primary-300 in-[.button-group-subtle]:dark:not-disabled:hover:bg-primary-900 in-[.button-group-subtle]:dark:focus-visible:ring-primary-400 in-[.button-group-subtle]:shadow-none in-[.button-group-outline]:inset-ring in-[.button-group-outline]:inset-ring-primary-300 in-[.button-group-outline]:bg-white in-[.button-group-outline]:text-primary-800 in-[.button-group-outline]:shadow-sm in-[.button-group-outline]:not-disabled:hover:bg-primary-50 in-[.button-group-outline]:not-disabled:active:bg-primary-100 in-[.button-group-outline]:focus-visible:ring-primary-700 in-[.button-group-outline]:dark:inset-ring-primary-700 in-[.button-group-outline]:dark:bg-dominant-900 in-[.button-group-outline]:dark:text-primary-200 in-[.button-group-outline]:dark:shadow-none in-[.button-group-outline]:dark:not-disabled:hover:bg-primary-900/50 in-[.button-group-outline]:dark:focus-visible:ring-primary-400 button-selected:bg-primary-600 button-selected:text-white button-selected:inset-ring-primary-600 button-selected:not-disabled:hover:bg-primary-700 button-selected:not-disabled:hover:text-white button-selected:not-disabled:active:bg-primary-800 button-selected:dark:bg-primary-600 button-selected:dark:inset-ring-primary-600 button-selected:dark:text-white button-selected:dark:not-disabled:hover:bg-primary-700 button-selected:dark:not-disabled:hover:text-white button-selected:dark:not-disabled:active:bg-primary-800 button-selected:in-[.button-group-solid]:bg-primary-800 button-selected:in-[.button-group-solid]:not-disabled:hover:bg-primary-800 button-selected:in-[.button-group-solid]:dark:bg-primary-800 button-selected:in-[.button-group-solid]:dark:not-disabled:hover:bg-primary-800 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Open drawer</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-basic-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-md dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-basic-title"
aria-label="Product details"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-basic-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
Product details
</h2>
<button
type="button"
aria-controls="drawer-basic-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1720"
type="button"
aria-controls="drawer-basic-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
<div id="drawer-discard" class="inline-flex">
<button
id="drawer-discard-button"
type="button"
aria-controls="drawer-discard-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Discard draft</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-discard-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none inset-x-0 bottom-0 max-h-full w-full rounded-t-2xl translate-y-full aria-[modal=true]:translate-y-0 dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
data-dialog-role="alertdialog"
aria-labelledby="drawer-discard-title"
aria-label="Discard this draft?"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-discard-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
Discard this draft?
</h2>
<button
type="button"
aria-controls="drawer-discard-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p>The draft and its photos will be removed. You cannot undo this.</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
<button
id="button-1863"
type="button"
aria-controls="drawer-discard-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Keep editing</span>
</button>
<button
id="button-1885"
type="button"
aria-controls="drawer-discard-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-danger-600 text-white shadow-sm not-disabled:hover:bg-danger-700 not-disabled:active:bg-danger-800 focus-visible:ring-danger-700 dark:focus-visible:ring-danger-400 in-[.button-group-subtle]:bg-danger-100 in-[.button-group-subtle]:text-danger-800 in-[.button-group-subtle]:not-disabled:hover:bg-danger-200 in-[.button-group-subtle]:not-disabled:active:bg-danger-300 in-[.button-group-subtle]:focus-visible:ring-danger-700 in-[.button-group-subtle]:dark:bg-danger-900/50 in-[.button-group-subtle]:dark:text-danger-300 in-[.button-group-subtle]:dark:not-disabled:hover:bg-danger-900 in-[.button-group-subtle]:dark:focus-visible:ring-danger-400 in-[.button-group-subtle]:shadow-none in-[.button-group-outline]:inset-ring in-[.button-group-outline]:inset-ring-danger-300 in-[.button-group-outline]:bg-white in-[.button-group-outline]:text-danger-800 in-[.button-group-outline]:shadow-sm in-[.button-group-outline]:not-disabled:hover:bg-danger-50 in-[.button-group-outline]:not-disabled:active:bg-danger-100 in-[.button-group-outline]:focus-visible:ring-danger-700 in-[.button-group-outline]:dark:inset-ring-danger-700 in-[.button-group-outline]:dark:bg-dominant-900 in-[.button-group-outline]:dark:text-danger-200 in-[.button-group-outline]:dark:shadow-none in-[.button-group-outline]:dark:not-disabled:hover:bg-danger-900/50 in-[.button-group-outline]:dark:focus-visible:ring-danger-400 button-selected:bg-danger-600 button-selected:text-white button-selected:inset-ring-danger-600 button-selected:not-disabled:hover:bg-danger-700 button-selected:not-disabled:hover:text-white button-selected:not-disabled:active:bg-danger-800 button-selected:dark:bg-danger-600 button-selected:dark:inset-ring-danger-600 button-selected:dark:text-white button-selected:dark:not-disabled:hover:bg-danger-700 button-selected:dark:not-disabled:hover:text-white button-selected:dark:not-disabled:active:bg-danger-800 button-selected:in-[.button-group-solid]:bg-danger-800 button-selected:in-[.button-group-solid]:not-disabled:hover:bg-danger-800 button-selected:in-[.button-group-solid]:dark:bg-danger-800 button-selected:in-[.button-group-solid]:dark:not-disabled:hover:bg-danger-800 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Discard</span>
</button>
</div>
</div>
</div>
</div>
</div>
Custom header
The header slot replaces the title; the close button stays, and title becomes the aria-label of the dialog.
Alex Morgan
Product manager
Alex leads the catalogue team and published 24 products this month.
<div id="drawer-custom-header" class="inline-flex">
<button
id="drawer-custom-header-button"
type="button"
aria-controls="drawer-custom-header-panel"
aria-expanded="false"
aria-haspopup="dialog"
aria-label="Open the member profile"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 size-10 p-0 text-sm in-[.button-group-extra-small]:size-6 in-[.button-group-extra-small]:p-0 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:size-8 in-[.button-group-small]:p-0 in-[.button-group-small]:text-sm in-[.button-group-large]:size-12 in-[.button-group-large]:p-0 in-[.button-group-large]:text-base in-[.button-group-extra-large]:size-14 in-[.button-group-extra-large]:p-0 in-[.button-group-extra-large]:text-lg"
>
<i aria-hidden="true" class="fa-solid fa-user"></i>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-custom-header-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-md dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-custom-header-title"
aria-label="Member profile"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<div class="flex items-center gap-3 min-w-0">
<span id="avatar-1693-wrapper" class="relative inline-flex shrink-0">
<span
id="avatar-1693"
class="inline-flex shrink-0 items-center justify-center size-10 rounded-full font-semibold text-sm bg-primary-100 dark:bg-primary-900/50 text-primary-800 dark:text-primary-300"
aria-hidden="true"
>AM</span
>
</span>
<div class="min-w-0">
<p class="truncate text-base font-semibold text-dominant-900 dark:text-white">
Alex Morgan
</p>
<p class="truncate text-sm text-dominant-600 dark:text-dominant-300">Product manager</p>
</div>
</div>
<button
type="button"
aria-controls="drawer-custom-header-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p>Alex leads the catalogue team and published 24 products this month.</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1785"
type="button"
aria-controls="drawer-custom-header-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 in-[.button-group-subtle]:bg-primary-100 in-[.button-group-subtle]:text-primary-800 in-[.button-group-subtle]:not-disabled:hover:bg-primary-200 in-[.button-group-subtle]:not-disabled:active:bg-primary-300 in-[.button-group-subtle]:focus-visible:ring-primary-700 in-[.button-group-subtle]:dark:bg-primary-900/50 in-[.button-group-subtle]:dark:text-primary-300 in-[.button-group-subtle]:dark:not-disabled:hover:bg-primary-900 in-[.button-group-subtle]:dark:focus-visible:ring-primary-400 in-[.button-group-subtle]:shadow-none in-[.button-group-outline]:inset-ring in-[.button-group-outline]:inset-ring-primary-300 in-[.button-group-outline]:bg-white in-[.button-group-outline]:text-primary-800 in-[.button-group-outline]:shadow-sm in-[.button-group-outline]:not-disabled:hover:bg-primary-50 in-[.button-group-outline]:not-disabled:active:bg-primary-100 in-[.button-group-outline]:focus-visible:ring-primary-700 in-[.button-group-outline]:dark:inset-ring-primary-700 in-[.button-group-outline]:dark:bg-dominant-900 in-[.button-group-outline]:dark:text-primary-200 in-[.button-group-outline]:dark:shadow-none in-[.button-group-outline]:dark:not-disabled:hover:bg-primary-900/50 in-[.button-group-outline]:dark:focus-visible:ring-primary-400 button-selected:bg-primary-600 button-selected:text-white button-selected:inset-ring-primary-600 button-selected:not-disabled:hover:bg-primary-700 button-selected:not-disabled:hover:text-white button-selected:not-disabled:active:bg-primary-800 button-selected:dark:bg-primary-600 button-selected:dark:inset-ring-primary-600 button-selected:dark:text-white button-selected:dark:not-disabled:hover:bg-primary-700 button-selected:dark:not-disabled:hover:text-white button-selected:dark:not-disabled:active:bg-primary-800 button-selected:in-[.button-group-solid]:bg-primary-800 button-selected:in-[.button-group-solid]:not-disabled:hover:bg-primary-800 button-selected:in-[.button-group-solid]:dark:bg-primary-800 button-selected:in-[.button-group-solid]:dark:not-disabled:hover:bg-primary-800 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Done</span>
</button>
</div>
</div>
</div>
</div>
Placement
From the right (the default, for details and forms), the left (navigation), the top or the bottom (a sheet on a phone). Only the position classes and the translate classes change.
From the right
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
From the left
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
From the top
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
From the bottom
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
<div id="drawer-right" class="inline-flex">
<button
id="drawer-right-button"
type="button"
aria-controls="drawer-right-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Right</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-right-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-md dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-right-title"
aria-label="From the right"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-right-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
From the right
</h2>
<button
type="button"
aria-controls="drawer-right-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1725"
type="button"
aria-controls="drawer-right-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
<div id="drawer-left" class="inline-flex">
<button
id="drawer-left-button"
type="button"
aria-controls="drawer-left-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Left</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-left-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none left-0 -translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-md dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-left-title"
aria-label="From the left"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-left-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
From the left
</h2>
<button
type="button"
aria-controls="drawer-left-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1866"
type="button"
aria-controls="drawer-left-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
<div id="drawer-top" class="inline-flex">
<button
id="drawer-top-button"
type="button"
aria-controls="drawer-top-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Top</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-top-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none inset-x-0 top-0 max-h-full w-full rounded-b-2xl -translate-y-full aria-[modal=true]:translate-y-0 dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-top-title"
aria-label="From the top"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2 id="drawer-top-title" class="text-base font-semibold text-dominant-900 dark:text-white">
From the top
</h2>
<button
type="button"
aria-controls="drawer-top-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1938"
type="button"
aria-controls="drawer-top-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
<div id="drawer-bottom" class="inline-flex">
<button
id="drawer-bottom-button"
type="button"
aria-controls="drawer-bottom-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Bottom</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-bottom-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none inset-x-0 bottom-0 max-h-full w-full rounded-t-2xl translate-y-full aria-[modal=true]:translate-y-0 dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-bottom-title"
aria-label="From the bottom"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-bottom-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
From the bottom
</h2>
<button
type="button"
aria-controls="drawer-bottom-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1992"
type="button"
aria-controls="drawer-bottom-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
Sizes
The panel is w-full with a maximum: max-w-sm, max-w-md or max-w-2xl. On a phone every size fills the screen.
Size small
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Size medium
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Size large
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
Use a drawer for a task that belongs to the page behind it: the person keeps their place and comes back to it when the drawer closes.
<div id="drawer-size-small" class="inline-flex">
<button
id="drawer-size-small-button"
type="button"
aria-controls="drawer-size-small-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Small</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-size-small-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-sm dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-size-small-title"
aria-label="Size small"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-size-small-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
Size small
</h2>
<button
type="button"
aria-controls="drawer-size-small-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1737"
type="button"
aria-controls="drawer-size-small-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
<div id="drawer-size-medium" class="inline-flex">
<button
id="drawer-size-medium-button"
type="button"
aria-controls="drawer-size-medium-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Medium</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-size-medium-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-md dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-size-medium-title"
aria-label="Size medium"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-size-medium-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
Size medium
</h2>
<button
type="button"
aria-controls="drawer-size-medium-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1872"
type="button"
aria-controls="drawer-size-medium-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
<div id="drawer-size-large" class="inline-flex">
<button
id="drawer-size-large-button"
type="button"
aria-controls="drawer-size-large-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Large</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-size-large-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-lg dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-size-large-title"
aria-label="Size large"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-size-large-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
Size large
</h2>
<button
type="button"
aria-controls="drawer-size-large-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
<p class="mb-3 last:mb-0">
Use a drawer for a task that belongs to the page behind it: the person keeps their place
and comes back to it when the drawer closes.
</p>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<button
id="button-1942"
type="button"
aria-controls="drawer-size-large-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<span>Save</span>
</button>
</div>
</div>
</div>
</div>
Filters form
A form in a drawer keeps the list visible behind the backdrop. The body scrolls on its own, so the header and the buttons stay in view. Every field has a visible label; the first focusable control (the close button) receives the focus when it opens.
Filter products
<div id="drawer-filters" class="inline-flex">
<button
id="drawer-filters-button"
type="button"
aria-controls="drawer-filters-panel"
aria-expanded="false"
aria-haspopup="dialog"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm in-[.button-group-extra-small]:gap-1.5 in-[.button-group-extra-small]:px-2.5 in-[.button-group-extra-small]:py-1 in-[.button-group-extra-small]:text-xs in-[.button-group-small]:gap-1.5 in-[.button-group-small]:px-3 in-[.button-group-small]:py-1.5 in-[.button-group-small]:text-sm in-[.button-group-large]:gap-2 in-[.button-group-large]:px-5 in-[.button-group-large]:py-3 in-[.button-group-large]:text-base in-[.button-group-extra-large]:gap-2.5 in-[.button-group-extra-large]:px-6 in-[.button-group-extra-large]:py-3.5 in-[.button-group-extra-large]:text-lg"
>
<i aria-hidden="true" class="fa-solid fa-filter"></i><span>Filters</span>
</button>
<div
class="fixed inset-0 z-50 bg-dominant-950/60 opacity-0 invisible transition-all duration-300 motion-reduce:transition-none has-[>[aria-modal=true]]:visible has-[>[aria-modal=true]]:opacity-100"
>
<div
id="drawer-filters-panel"
class="absolute flex flex-col bg-white shadow-xl transition-transform duration-300 motion-reduce:transition-none right-0 translate-x-full aria-[modal=true]:translate-x-0 inset-y-0 h-full w-full max-w-sm dark:bg-dominant-900 dark:ring-1 dark:ring-dominant-700"
aria-labelledby="drawer-filters-title"
aria-label="Filter products"
>
<div
class="flex items-center justify-between gap-4 px-5 py-3 border-b border-dominant-200 dark:border-dominant-700"
>
<h2
id="drawer-filters-title"
class="text-base font-semibold text-dominant-900 dark:text-white"
>
Filter products
</h2>
<button
type="button"
aria-controls="drawer-filters-panel"
aria-label="Close"
class="inline-flex items-center justify-center size-9 text-dominant-700 dark:text-dominant-200 rounded-lg cursor-pointer hover:bg-dominant-100 dark:hover:bg-dominant-800 hover:text-dominant-900 dark:hover:text-white focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 focus-visible:outline-none"
>
<i aria-hidden="true" class="fa-solid fa-xmark"> </i>
</button>
</div>
<div
class="flex-1 overflow-y-auto px-5 py-4 text-sm text-dominant-700 dark:text-dominant-200"
>
<form class="space-y-5">
<div id="drawer-filters-category-field" class="group/field">
<label
for="drawer-filters-category"
class="block mb-1.5 text-sm font-medium text-dominant-700 dark:text-dominant-200 group-has-[:is(input,select,textarea):disabled]/field:opacity-50 group-has-[:is(input,select,textarea):required]/field:after:content-['*'] after:ml-0.5 after:text-danger-700 dark:after:text-danger-300"
>Category</label
>
<div class="relative">
<select
id="drawer-filters-category"
class="block w-full appearance-none rounded-lg bg-white dark:bg-dominant-950 text-dominant-900 dark:text-white inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 dark:scheme-dark focus:inset-ring-primary-500 dark:focus:inset-ring-primary-400 focus:ring-2 focus:ring-primary-500/30 dark:focus:ring-primary-400/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400 aria-invalid:focus:inset-ring-danger-600 dark:aria-invalid:focus:inset-ring-danger-400 aria-invalid:focus:ring-danger-600/30 dark:aria-invalid:focus:ring-danger-400/30 px-3.5 py-2.5 text-sm pr-10"
name="category"
>
<option value="All categories">All categories</option>
<option value="Accessories">Accessories</option>
<option value="Storage">Storage</option>
<option value="Peripherals">Peripherals</option>
</select>
<i
aria-hidden="true"
class="fa-solid fa-chevron-down pointer-events-none absolute right-3.5 top-5 -translate-y-1/2 text-xs text-dominant-600 dark:text-dominant-300"
>
</i>
</div>
</div>
<div class="grid grid-cols-2 gap-3">
<div id="drawer-filters-min-field" class="group/field">
<label
for="drawer-filters-min"
class="block mb-1.5 text-sm font-medium text-dominant-700 dark:text-dominant-200 group-has-[:is(input,select,textarea):disabled]/field:opacity-50 group-has-[:is(input,select,textarea):required]/field:after:content-['*'] after:ml-0.5 after:text-danger-700 dark:after:text-danger-300"
>Min price</label
>
<input
id="drawer-filters-min"
type="number"
class="block w-full rounded-lg bg-white dark:bg-dominant-950 text-dominant-900 dark:text-white inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 placeholder:text-dominant-600 dark:placeholder:text-dominant-400 focus:inset-ring-primary-500 dark:focus:inset-ring-primary-400 focus:ring-2 focus:ring-primary-500/30 dark:focus:ring-primary-400/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400 aria-invalid:focus:inset-ring-danger-600 dark:aria-invalid:focus:inset-ring-danger-400 aria-invalid:focus:ring-danger-600/30 dark:aria-invalid:focus:ring-danger-400/30 px-3.5 py-2.5 text-sm read-only:bg-dominant-100 dark:read-only:bg-dominant-800"
name="min-price"
min="0"
placeholder="0"
/>
</div>
<div id="drawer-filters-max-field" class="group/field">
<label
for="drawer-filters-max"
class="block mb-1.5 text-sm font-medium text-dominant-700 dark:text-dominant-200 group-has-[:is(input,select,textarea):disabled]/field:opacity-50 group-has-[:is(input,select,textarea):required]/field:after:content-['*'] after:ml-0.5 after:text-danger-700 dark:after:text-danger-300"
>Max price</label
>
<input
id="drawer-filters-max"
type="number"
class="block w-full rounded-lg bg-white dark:bg-dominant-950 text-dominant-900 dark:text-white inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 placeholder:text-dominant-600 dark:placeholder:text-dominant-400 focus:inset-ring-primary-500 dark:focus:inset-ring-primary-400 focus:ring-2 focus:ring-primary-500/30 dark:focus:ring-primary-400/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400 aria-invalid:focus:inset-ring-danger-600 dark:aria-invalid:focus:inset-ring-danger-400 aria-invalid:focus:ring-danger-600/30 dark:aria-invalid:focus:ring-danger-400/30 px-3.5 py-2.5 text-sm read-only:bg-dominant-100 dark:read-only:bg-dominant-800"
name="max-price"
min="0"
placeholder="500"
/>
</div>
</div>
<fieldset>
<legend class="mb-3 text-sm font-medium text-dominant-900 dark:text-white">
Show only
</legend>
<div class="space-y-3">
<div id="drawer-filters-stock-field" class="group/field">
<div class="flex items-start gap-3">
<span class="relative flex shrink-0 mt-0.5 size-5">
<input
id="drawer-filters-stock"
class="size-5 shrink-0 appearance-none bg-white dark:bg-dominant-950 rounded inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 cursor-pointer peer checked:bg-primary-600 dark:checked:bg-primary-400 checked:inset-ring-primary-600 dark:checked:inset-ring-primary-400 indeterminate:bg-primary-600 dark:indeterminate:bg-primary-400 indeterminate:inset-ring-primary-600 dark:indeterminate:inset-ring-primary-400 focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 dark:focus-visible:ring-offset-dominant-900 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400"
name="show-only"
value="in-stock"
type="checkbox"
/>
<i
aria-hidden="true"
class="absolute inset-0 hidden items-center justify-center !w-full text-xs text-white dark:text-dominant-950 pointer-events-none fa-solid fa-check peer-checked:flex peer-indeterminate:flex peer-indeterminate:[--fa:'\f068'] peer-disabled:opacity-50"
>
</i>
</span>
<div class="text-sm">
<label
for="drawer-filters-stock"
class="font-medium text-dominant-900 dark:text-white cursor-pointer after:ml-0.5 after:text-danger-700 dark:after:text-danger-300 group-has-[input:disabled]/field:cursor-not-allowed group-has-[input:disabled]/field:opacity-50 group-has-[input:required]/field:after:content-['*']"
>In stock</label
>
</div>
</div>
</div>
<div id="drawer-filters-sale-field" class="group/field">
<div class="flex items-start gap-3">
<span class="relative flex shrink-0 mt-0.5 size-5">
<input
id="drawer-filters-sale"
class="size-5 shrink-0 appearance-none bg-white dark:bg-dominant-950 rounded inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 cursor-pointer peer checked:bg-primary-600 dark:checked:bg-primary-400 checked:inset-ring-primary-600 dark:checked:inset-ring-primary-400 indeterminate:bg-primary-600 dark:indeterminate:bg-primary-400 indeterminate:inset-ring-primary-600 dark:indeterminate:inset-ring-primary-400 focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 dark:focus-visible:ring-offset-dominant-900 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400"
name="show-only"
value="on-sale"
type="checkbox"
/>
<i
aria-hidden="true"
class="absolute inset-0 hidden items-center justify-center !w-full text-xs text-white dark:text-dominant-950 pointer-events-none fa-solid fa-check peer-checked:flex peer-indeterminate:flex peer-indeterminate:[--fa:'\f068'] peer-disabled:opacity-50"
>
</i>
</span>
<div class="text-sm">
<label
for="drawer-filters-sale"
class="font-medium text-dominant-900 dark:text-white cursor-pointer after:ml-0.5 after:text-danger-700 dark:after:text-danger-300 group-has-[input:disabled]/field:cursor-not-allowed group-has-[input:disabled]/field:opacity-50 group-has-[input:required]/field:after:content-['*']"
>On sale</label
>
</div>
</div>
</div>
<div id="drawer-filters-new-field" class="group/field">
<div class="flex items-start gap-3">
<span class="relative flex shrink-0 mt-0.5 size-5">
<input
id="drawer-filters-new"
class="size-5 shrink-0 appearance-none bg-white dark:bg-dominant-950 rounded inset-ring inset-ring-dominant-500 dark:inset-ring-dominant-400 cursor-pointer peer checked:bg-primary-600 dark:checked:bg-primary-400 checked:inset-ring-primary-600 dark:checked:inset-ring-primary-400 indeterminate:bg-primary-600 dark:indeterminate:bg-primary-400 indeterminate:inset-ring-primary-600 dark:indeterminate:inset-ring-primary-400 focus-visible:ring-2 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 dark:focus-visible:ring-offset-dominant-900 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:inset-ring-danger-600 dark:aria-invalid:inset-ring-danger-400"
name="show-only"
value="new-this-month"
type="checkbox"
/>
<i
aria-hidden="true"
class="absolute inset-0 hidden items-center justify-center !w-full text-xs text-white dark:text-dominant-950 pointer-events-none fa-solid fa-check peer-checked:flex peer-indeterminate:flex peer-indeterminate:[--fa:'\f068'] peer-disabled:opacity-50"
>
</i>
</span>
<div class="text-sm">
<label
for="drawer-filters-new"
class="font-medium text-dominant-900 dark:text-white cursor-pointer after:ml-0.5 after:text-danger-700 dark:after:text-danger-300 group-has-[input:disabled]/field:cursor-not-allowed group-has-[input:disabled]/field:opacity-50 group-has-[input:required]/field:after:content-['*']"
>New this month</label
>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
<div
class="flex justify-end gap-3 px-5 py-4 border-t border-dominant-200 dark:border-dominant-700"
>
<div class="flex justify-between gap-3 w-full">
<button
id="button-1952"
type="button"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 inset-ring inset-ring-dominant-300 dark:inset-ring-dominant-600 bg-white dark:bg-dominant-800 text-dominant-700 dark:text-dominant-200 dark:shadow-none shadow-sm not-disabled:hover:bg-dominant-100 dark:not-disabled:hover:bg-dominant-700 not-disabled:hover:text-dominant-900 dark:not-disabled:hover:text-white not-disabled:active:bg-dominant-200 dark:not-disabled:active:bg-dominant-600 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm"
>
<span>Reset</span>
</button>
<button
id="button-1966"
type="button"
aria-controls="drawer-filters-panel"
class="cursor-pointer transition-colors inline-flex items-center justify-center rounded-lg font-semibold group peer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-dominant-950 bg-primary-600 text-white shadow-sm not-disabled:hover:bg-primary-700 not-disabled:active:bg-primary-800 focus-visible:ring-primary-700 dark:focus-visible:ring-primary-400 gap-2 px-4 py-2.5 text-sm"
>
<span>Show results</span>
</button>
</div>
</div>
</div>
</div>
</div>
Options reference
No script of its own: the popup script of the page handles the dialog.
| Part | Value | Description |
|---|---|---|
| Trigger |
aria-haspopup="dialog", aria-controls, aria-expanded
|
The popup script opens and closes the drawer and keeps aria-expanded.
|
| Backdrop |
invisible → has-[>[aria-modal=true]]:visible
|
Fades in with the drawer. A click on it closes the drawer. |
| Panel |
<id>-panel, aria-labelledby
|
Gets role="dialog" and aria-modal while open.
|
| Placement | right, left, top, bottom |
Position classes plus translate-x-full or translate-y-full when closed.
|
| Size |
max-w-sm, max-w-md, max-w-2xl
|
Maximum width of a side drawer. |
| Closer |
button with the same aria-controls
|
Inside the panel: the X in the header, Cancel, Save. |
| Motion |
motion-reduce:transition-none
|
No slide for people who ask for less motion. |