hydrogen-cart-drawer
Skill by Shopify
Guides developers in building an accessible cart drawer with @shopify/hydrogen. It covers native dialog markup, light dismiss, body scroll lock, exit animations and wiring window.Shopify.actions.openCart().
Install hydrogen-cart-drawer
Built from the published package, never by AI.
git clone --depth 1 https://github.com/Shopify/hydrogen /tmp/hydrogen && mkdir -p ~/.claude/skills && cp -r /tmp/hydrogen/packages/hydrogen/skills/hydrogen-cart-drawer ~/.claude/skills/hydrogen-cart-drawerRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/Shopify/hydrogen /tmp/hydrogen && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/hydrogen/packages/hydrogen/skills/hydrogen-cart-drawer ~/.gemini/antigravity-cli/skills/hydrogen-cart-drawerAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install hydrogen-cart-drawer in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a guide for building an accessible cart drawer in a Shopify Hydrogen storefront. It describes the drawer layout with header, body and footer zones, and the empty cart state. It covers the native dialog element opened with showModal(), closedby light dismiss, body scroll lock and exit animations.
The guide shows how to register the drawer with window.Shopify.actions.openCart() so any code can open it. It explains that the drawer is progressive enhancement over a /cart page that works without JavaScript. It is aimed at developers building or reviewing cart drawers, mini carts or slide-out carts.
Written from the project's SKILL.md and checked against it.
What it can do
- Drawer structureDefines header, body and footer zones and the empty cart state for the drawer.
- Native dialogBuilds the drawer on a dialog element opened with showModal() and closed with close().
- Light dismissUses closedby="any" so a backdrop click closes the drawer in supporting browsers.
- Scroll lock and animationsDescribes CSS for body scroll lock, entry and exit animations, and the backdrop.
- Standard Actions wiringRegisters a handler so window.Shopify.actions.openCart() opens the drawer.
- Cart triggerRenders a /cart link before hydration and opens the drawer on click after hydration.
- Add-to-cart openingShows how to open the drawer from an add-to-cart form before the mutation finishes.
- Accessibility checklistLists tests for Escape, focus return, tab containment and screen reader announcements.
What you need
- @shopify/hydrogen
- A /cart route in the storefront
- Shopify runtime scripts (ShopifyScripts)
- The local hydrogen-routing skill
- The local hydrogen-cart-ui skill
Try asking
- Build an accessible cart drawer in my Hydrogen store using a native dialog
- Wire window.Shopify.actions.openCart() to open my cart drawer
- Review my cart drawer for accessibility and focus handling
Good to know
- closedby="any" is not supported in all browsers, so backdrop click will not close the drawer there.
- The openCart handler has no unconfigure() and persists for the page lifetime.
- Astro view transitions require re-initializing a vanilla JS drawer after navigation.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: packages/hydrogen/skills/hydrogen-cart-drawer/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md12 KB -
references/accessibility.md6 KB -
references/css.md1 KB
Alternatives to hydrogen-cart-drawer
All alternatives →Shopify skill that lets an AI assistant set up and run a Shopify store through Shopify's official MCP server. It is for people who want to sell online, start a store, or manage an existing Shopify store.
Guides an AI assistant through building Shopify apps, extensions and themes. It covers the GraphQL Admin API, Shopify CLI, Polaris UI and Liquid. Intended for Shopify developers.
Searches Ticketmaster events and seat listings with pricing for people looking for event tickets. It returns Ticketmaster checkout links but cannot complete a purchase itself.
Analyzes ecommerce SEO for product pages, product schema, Google Shopping visibility, Amazon marketplace signals and keyword gaps. Built for stores, catalogs and product listings. Live Shopping and Amazon data needs the optional DataForSEO Merchant API.
Drafts replies to customer emails and tickets using order, refund, CRM and support desk data, in the owner's writing voice. Refunds and sends need the owner's approval, and with Shopify it also flags orders needing attention.
Reviews generated or changed WooCommerce code before it ships. It is for developers building extensions, payment and shipping integrations, checkout customizations, and order or product logic.
Compare with shopify, shopify-development or ticketmaster
hydrogen-cart-drawer: common questions
What does the cart drawer skill help me build?
It helps you build an accessible cart drawer for a Hydrogen storefront. It uses the native dialog element with showModal(), light dismiss, scroll lock and exit animations.
How can other code open the cart drawer?
The skill registers the drawer with window.Shopify.actions.openCart(). Any code, including Standard Actions tools and third-party components, can then call it to open the drawer.
What happens if JavaScript is not available?
The cart trigger is a /cart link, so it navigates to the full cart page. The drawer is an enhancement layered on top after hydration.
How do I install hydrogen-cart-drawer?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is hydrogen-cart-drawer free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is hydrogen-cart-drawer safe to use?
It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to hydrogen-cart-drawer?
Similar skills: shopify, shopify-development, ticketmaster, seo-ecommerce.
