Collapse
Show and hide a section with a smooth slide. Point a button at it — Moey animates the height and keeps everything accessible.
<button class="btn" data-moey-collapse="#details">
Show details <i class="mi mi-chevron-down collapse-chevron"></i>
</button>
<div class="collapse" id="details" hidden>…</div>
Leave out hidden to start open. The button gets aria-expanded and aria-controls automatically, and .collapse-chevron turns when it’s open. A link works too: <a href="#details" data-moey-collapse>.
Closed sections stay searchable: press and look for “Thursday” — the browser opens the section that holds it (Chrome and Edge).
Change the button text
data-moey-collapse-text is the text while it’s open. Put the words in a .collapse-text span to keep the icon.
<button class="btn btn-ghost" data-moey-collapse="#cl-filters" data-moey-collapse-text="Fewer filters">
<i class="mi mi-sliders-horizontal"></i>
<span class="collapse-text">More filters</span>
</button>
<div class="collapse" id="cl-filters" hidden>
<div class="grid g-3 mt-4">
<div class="field span-12 md:span-4">
<label class="form-label" for="cl-status">Status</label>
<select class="form-select" id="cl-status">
<option>Any</option>
<option>Paid</option>
<option>Refunded</option>
</select>
</div>
<div class="field span-12 md:span-4">
<label class="form-label" for="cl-from">From</label>
<input class="form-control" id="cl-from" type="date">
</div>
<div class="field span-12 md:span-4">
<label class="form-label" for="cl-min">Minimum total</label>
<input class="form-control" id="cl-min" type="number" placeholder="0">
</div>
</div>
</div>
Show more text
.collapse-preview shows the first lines, faded, until it’s opened. Set the preview height with --mo-collapse-preview.
Moey Supply started in 2019 as a two-person shop selling mugs at weekend markets. Today we ship to 40 countries from a small warehouse in Lisbon, and every order is still packed by hand.
We print on recycled stock, ship in plastic-free boxes, and plant a tree for every hundred orders. If something arrives damaged, write to us — we'll send a new one the same day.
Questions about wholesale? Our team answers within one business day.
<style>.about-preview { --mo-collapse-preview: 4.5rem; }</style>
<div class="collapse collapse-preview about-preview" id="about">…long text…</div>
<button class="btn btn-ghost btn-sm" data-moey-collapse="#about" data-moey-collapse-text="Show less">Show more</button>
One open at a time
Give the sections data-moey-parent with their container — opening one closes the others. (For simple question lists, the accordion does this with no JavaScript.)
Use the tracking link in your shipping email, or find the order under Orders → Tracking.
Yes, until the order ships. Open the order and choose Edit address.
Refunds go back to the original payment within 5–10 business days.
<div id="faq">
<button data-moey-collapse="#faq-1">Where is my order?</button>
<div class="collapse" id="faq-1" data-moey-parent="#faq" hidden>…</div>
<button data-moey-collapse="#faq-2">Can I change my address?</button>
<div class="collapse" id="faq-2" data-moey-parent="#faq" hidden>…</div>
</div>
One button, several sections
The button takes any selector.
<button data-moey-collapse=".extra">Show extra columns</button>
From code & events
Moey.collapse('#details'); // toggle
Moey.collapse(el, true); // open (false = close)
el.addEventListener('moey:open', (e) => { if (!ready) e.preventDefault(); }); // cancelable
el.addEventListener('moey:opened', () => loadChart()); // after the animation
| Class / attribute | What it does |
|---|---|
data-moey-collapse="#id" | On a button or link: toggles the section(s) the selector finds (a link can use its href) |
.collapse + hidden | The section; starts closed with hidden |
data-moey-collapse-text | The button’s text while open (changes .collapse-text if there is one) |
.collapse-chevron | An icon in the button that turns while open |
.collapse-preview · --mo-collapse-preview | Shows a faded preview instead of hiding · its height (default 6rem) |
data-moey-parent="#group" | On sections: only one open at a time within #group |
| Events | moey:open / moey:close (cancelable) · moey:opened / moey:closed |