Skip to content

Drawer

Terminal window
pnpm add @agencecinq/drawer
import '@agencecinq/drawer';
<cinq-drawer-button class="block">
<button aria-controls="demo-drawer">Open drawer</button>
</cinq-drawer-button>
<cinq-drawer cid="demo-drawer" class="group">
<div data-dom="overlay" class="fixed inset-0 z-[2147483646] bg-black/50 opacity-0 pointer-events-none group-[[open]]:opacity-100 group-[[open]]:pointer-events-auto"></div>
<div role="dialog" class="fixed right-0 top-0 z-[2147483647] h-full w-full max-w-md bg-white shadow-2xl translate-x-full transition-transform group-[[open]]:translate-x-0">
<div class="p-8 flex flex-col gap-4">
<h2 class="text-2xl font-bold">Bestiary drawer</h2>
<p class="text-gray-600">
Use the drawer as a sliding panel listing creatures from your AD&amp;D bestiary: trolls,
dracoliches, or galeb duhrs guarding the dungeon entrance.
</p>
<cinq-drawer-button class="block">
<button aria-controls="demo-drawer">Close</button>
</cinq-drawer-button>
</div>
</div>
</cinq-drawer>
AttributeRequiredDescription
cidYesDrawer identifier (falls back to id).
openNoReflected state attribute (useful for styling).
MethodDescription
open()Opens the drawer.
close()Closes the drawer.
toggle()Toggles between open and closed.
EventDispatched byDetail payloadDescription
drawer-togglecinq-drawer-button{ drawer, trigger, trap }Emitted on document.documentElement to request a toggle.
drawer-opencinq-drawerFired after the drawer has been opened.
drawer-closecinq-drawerFired after the drawer has been closed.

If you are integrating in a Shopify theme, you can use the provided snippet and Vite plugin.

import { defineConfig } from 'vite';
import { cinqDrawerPlugin } from '@agencecinq/drawer/plugin';
export default defineConfig({
plugins: [cinqDrawerPlugin()],
});

This copies the package snippet to your theme:

  • snippets/cinq-drawer.html.liquid
{% render 'cinq-drawer.html',
id: 'cart-drawer',
content: '<div class="p-8"><p class="mb-2">The galeb duhr looks like a boulder until it moves.</p><p class="mb-0">Trolls and jermlaines skulk deeper in the dungeon corridors.</p></div>'
%}
<cinq-drawer-button class="block">
<button aria-controls="cart-drawer" aria-expanded="false">Open cart</button>
</cinq-drawer-button>

Cart drawer

A slide-in cart sidebar: overlay, scroll lock, and a simple list of AD&D‑style items.

Items in cart 3 monsters