Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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().

  • Score 88
  • 2.2k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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-drawer

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install hydrogen-cart-drawer in Claude Code

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

A

No 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 →

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.

hydrogen-cart-drawer Install

Add to stack

Loading.