LiquidInteractivity

Interactivity

Most of what feels interactive on a storefront (tabs, accordions, sliders, hover reveals, lightboxes) can be built with CSS alone. CSS-only sections load instantly, cannot break the page, and need no review of scripts. Reach for JavaScript only for what CSS genuinely cannot do.

Techniques

TechniqueMechanismUse it for
Scroll-snapscroll-snap-type: x mandatory on an overflow containerSliders, carousels, swipe rows
Native disclosure<details> / <summary>Accordions, FAQs, price lists
Anchor targeting:target with #id linksTabs, lightboxes, step-throughs
Checked siblinghidden <input type="radio"> with :checked ~Tabs, filter chips, variant pickers
Native controls<select>, <input type="number">Quantity pickers (read by cart-add)
Hover / focus-within:hover, :focus-withinReveals, hover galleries, tooltips
Keyframes@keyframes with animationMarquees, tickers, gradient motion
Stickyposition: stickyStacked-card scroll, sticky rails, sticky buy bars
GridCSS Grid, grid-auto-flow: denseBento, editorial and masonry-ish layouts

Every one of these falls back to a plain, readable page if the CSS fails. None can leave a section blank.

Tabs

Hidden radio buttons hold the state; :checked ~ shows the matching panel. The labels are the tabs. Click them in the preview.

Radio tabs
Playground
Loading editor…

Runs in your browser on sample data: the same engine and filters as the storefront. Widgets such as add to cart are simulated: clicking one shows what would happen on a store.

Accordion

<details> and <summary> open and close on their own, work with the keyboard, and are announced by screen readers.

Accordionliquid
<style>
.faq-{{ section.id }} { max-width: 600px; margin: 0 auto; padding: 24px; font-family: var(--font-body); }
.faq-{{ section.id }} details { border-bottom: 1px solid var(--color-border); }
.faq-{{ section.id }} summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 600; display: flex; justify-content: space-between; }
.faq-{{ section.id }} summary::-webkit-details-marker { display: none; }
.faq-{{ section.id }} summary::after { content: "+"; transition: transform .2s; }
.faq-{{ section.id }} details[open] summary::after { transform: rotate(45deg); }
.faq-{{ section.id }} p { margin: 0 0 14px; color: var(--color-text-muted); }
</style>
<div class="faq-{{ section.id }}">
<details open><summary>How long does delivery take?</summary><p>One to two days inside the valley.</p></details>
<details><summary>Can I return something?</summary><p>Yes, within seven days, unworn.</p></details>
<details><summary>Do you gift-wrap?</summary><p>Every order, free.</p></details>
</div>

Swipe slider

scroll-snap turns an overflowing row into a slider that swipes on phones and scrolls with a trackpad. For arrows, dots and autoplay, use the carousel widget and keep this as its fallback.

Scroll-snap sliderliquid
<style>
.sl-{{ section.id }} { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
padding: 24px; scrollbar-width: thin; }
.sl-{{ section.id }} a { flex: 0 0 70%; max-width: 280px; scroll-snap-align: start; color: var(--color-text);
text-decoration: none; font-family: var(--font-body); }
.sl-{{ section.id }} img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--radius); }
</style>
<div class="sl-{{ section.id }}">
{%- for item in products -%}
<a href="{{ item.url }}">
<img src="{{ item.featured_image | image_url: 500 }}" alt="{{ item.title | escape }}">
{{ item.title }}
</a>
{%- endfor -%}
</div>

Marquee

The content is rendered twice and the track slides by half its width, so the loop is seamless. The second copy is aria-hidden, and the animation stops for visitors who ask for reduced motion.

Marqueeliquid
<style>
.mq-{{ section.id }} { overflow: hidden; background: var(--color-primary); color: var(--color-on-primary);
font: 600 15px var(--font-heading); padding: 12px 0; }
.mq-{{ section.id }}-track { display: flex; width: max-content; animation: mq-{{ section.id }} 18s linear infinite; }
.mq-{{ section.id }}-track span { padding: 0 24px; white-space: nowrap; }
@keyframes mq-{{ section.id }} { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
.mq-{{ section.id }}-track { animation: none; }
.mq-{{ section.id }} { overflow-x: auto; }
}
</style>
<div class="mq-{{ section.id }}">
<div class="mq-{{ section.id }}-track">
{%- for pass in (1..2) -%}
<span{% if pass == 2 %} aria-hidden="true"{% endif %}>Free delivery over Rs 3,000</span>
<span{% if pass == 2 %} aria-hidden="true"{% endif %}>New linen drop</span>
<span{% if pass == 2 %} aria-hidden="true"{% endif %}>Gift-wrapped, always</span>
{%- endfor -%}
</div>
</div>

Lightbox

Each thumbnail links to an id; :target shows the matching overlay and the close link clears it. The preview keeps in-page links working, so you can try it.

Lightboxliquid
<style>
.lb-{{ section.id }} { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 24px; }
.lb-{{ section.id }} img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.lb-{{ section.id }}-view { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
align-items: center; justify-content: center; }
.lb-{{ section.id }}-view:target { display: flex; }
.lb-{{ section.id }}-view img { max-width: 90%; max-height: 90%; }
.lb-{{ section.id }}-view a.close { position: absolute; top: 12px; right: 18px; color: #fff; font-size: 28px; text-decoration: none; }
</style>
<div class="lb-{{ section.id }}">
{%- for img in product.images limit: 3 -%}
<a href="#lb-{{ section.id }}-{{ forloop.index }}"><img src="{{ img | image_url: 300 }}" alt="Photo {{ forloop.index }}"></a>
{%- endfor -%}
</div>
{%- for img in product.images limit: 3 -%}
<div class="lb-{{ section.id }}-view" id="lb-{{ section.id }}-{{ forloop.index }}">
<a class="close" href="#_" aria-label="Close">×</a>
<img src="{{ img | image_url: 1200 }}" alt="Photo {{ forloop.index }}, large">
</div>
{%- endfor -%}

When you need a script

These need state that CSS cannot hold:

Countdown timer · Live product filtering or sorting · A dismissible modal that stays dismissed · Animated counters · Drag before/after · Infinite scroll

Build them with a script in the section (see Tags & snippets for the rules), or point merchants to the built-in sections that already do them. For the cart, search, saved items, forms and carousels, use the storefront widgets: they are already on every store and need no script from you.

Do not fake it

A section that looks interactive and is not, like dots that do not move a slider or a filter bar that does not filter, is worse than one that never suggested it. Reviewers reject it.

Still stuck? Our team reads every message.

Need help?