Accordion
Acordeón · Accordion · Accordion expand · Disclosure · Pannelli espandibili
A list of items where each panel opens by smoothly stretching and pushing the ones below down while the chevron rotates. It is the classic way to show FAQs and details without crowding the page.
- Era
- 2007 – today
- Use
- Mainstream
Live demo
View code
<main>
<h1>Domande frequenti</h1>
<div class="acc">
<section class="it open"><button>Quanto costa la spedizione?<i></i></button><div class="p"><div><p>È gratuita sopra i 40 €, altrimenti 4,90 € in tutta Italia.</p></div></div></section>
<section class="it"><button>Posso restituire un ordine?<i></i></button><div class="p"><div><p>Hai 30 giorni per cambiare idea, il reso è sempre gratuito.</p></div></div></section>
<section class="it"><button>Quando arriva il pacco?<i></i></button><div class="p"><div><p>Di solito in 24–48 ore lavorative dalla conferma.</p></div></div></section>
</div>
</main>
<script>
const its=[...document.querySelectorAll('.it')];let k=0,auto=true;
const open=n=>its.forEach((e,i)=>e.classList.toggle('open',i===n));
its.forEach((e,i)=>e.querySelector('button').onclick=()=>{auto=false;open(e.classList.contains('open')?-1:i)});
if(matchMedia('(prefers-reduced-motion: no-preference)').matches)setInterval(()=>{if(auto){k=(k+1)%its.length;open(k)}},2200);
</script> body{margin:0;height:100vh;display:grid;place-items:center;background:#F4F1EC;color:#1B1F3B;font-family:'DM Sans',sans-serif}
main{width:380px;max-width:92vw}
h1{font-size:22px;margin:0 0 12px}
.acc{background:#fff;border-radius:16px;box-shadow:0 12px 30px -16px #1B1F3B55;overflow:hidden}
.it+.it{border-top:1px solid #D9D3C7}
button{all:unset;box-sizing:border-box;width:100%;display:flex;justify-content:space-between;align-items:center;padding:15px 18px;font-weight:700;font-size:15px;cursor:pointer}
i{width:24px;height:24px;border-radius:50%;background:#F4F1EC;position:relative;flex:none}
i::before,i::after{content:"";position:absolute;left:7px;top:11px;width:10px;height:2px;border-radius:2px;background:#FF7A45}
i::after{transform:rotate(90deg)}
.open i{background:#FF7A45}
.open i::before,.open i::after{background:#fff}
.open i::after{transform:rotate(0)}
.p{display:grid;grid-template-rows:0fr}
.p>div{overflow:hidden}
.open .p{grid-template-rows:1fr}
p{margin:0;padding:0 18px 16px;font-size:14px;line-height:1.45;color:#1B1F3Bb3;opacity:0}
.open p{opacity:1}
@media (prefers-reduced-motion:no-preference){
.p{transition:grid-template-rows .35s cubic-bezier(.4,0,.2,1)}
p{transition:opacity .3s .05s}
i,i::after{transition:transform .35s,background .35s}
} Characteristics
- Height animated from zero to the real content
- Chevron or plus icon rotating 90–180 degrees
- One panel open at a time or several
- Content appearing with a gentle fade
- Keyboard-accessible details and summary elements
Palette
Click a swatch to copy it
Typography
Headings · DM Sans Accordion
Body · DM Sans A list of items where each panel opens by smoothly stretching and pushing the ones below down while the chevron rotates. It is the classic way to show FAQs and details without crowding the page.
Motion
- Easing
cubic-bezier(0.4, 0, 0.2, 1)- Typical duration
- 200–350 ms
- Techniques
- grid-template-rows da 0fr a 1fr, interpolate-size: allow-keywords, details e summary, ::details-content, Web Animations API sull'altezza misurata, Radix Accordion
Accessibility (reduced motion)
Panels open and close instantly; only the icon change remains.
Prompt for your agent
Copy and paste into your prompt to have an agent or image generator reproduce this style.
For web pages and UI
Design the web page or interface in this style: Accordion (Acordeón). A list of items where each panel opens by smoothly stretching and pushing the ones below down while the chevron rotates. It is the classic way to show FAQs and details without crowding the page. Characteristics: Height animated from zero to the real content, Chevron or plus icon rotating 90–180 degrees, One panel open at a time or several, Content appearing with a gentle fade, Keyboard-accessible details and summary elements. Palette: #F4F1EC, #FFFFFF, #1B1F3B, #FF7A45, #D9D3C7. Typography: headings in DM Sans, body text in DM Sans (Google Fonts or equivalents). Mood: clean, calm, rational. Motion: easing cubic-bezier(0.4, 0, 0.2, 1), typical duration 200–350 ms; techniques: grid-template-rows da 0fr a 1fr, interpolate-size: allow-keywords, details e summary, ::details-content, Web Animations API sull'altezza misurata, Radix Accordion. With prefers-reduced-motion: Panels open and close instantly; only the icon change remains. References: jQuery UI Accordion (2007), elementi HTML details e summary, Radix UI Accordion, pagine FAQ dei negozi online.
Relations
Derives from
Similar to
References
- jQuery UI Accordion (2007)
- elementi HTML details e summary
- Radix UI Accordion
- pagine FAQ dei negozi online