1. Reference
  2. Forms and input

<accordion>

A panel that opens and closes on a tap of its header, as HTML's details and summary.

Forms and input

This tag has more than one name. Every spelling is the same tag, so write whichever feels natural. Pick one and every example on this page uses it.

accordion.ham
<column style="w-full">
    <accordion title="Shipping"
               icon="local_shipping"
               expanded="true">
        <text>Free over $50. Orders ship within two working days.</text>
    </accordion>
    <accordion>
        <summary>Returns</summary>
        <text>Return anything unworn within 30 days.</text>
    </accordion>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
expanded Initially expanded
boolean
false
icon Leading icon
string
open HTML form of expanded (for <accordion>); bare attribute works
boolean
false
subtitle Subtitle text
string
title Header title; none without it (or a <summary>)
string
variant plain: no Material tile. The <summary> is the header as written (your own row and chevron), a tap opens and closes the rest, nothing is padded or indented; \$id.open says which, and #id.open / #id.close / #id.toggle work.
plain

Commands

NameWhat it does
close variant="plain": close it.
open variant="plain": open it.
toggle variant="plain": open or close it.

Readings

NameWhat it does
expanded The same, named after expanded=.
open Whether the panel is open.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

This page is also Markdown, and all of HAM is in llms.txt.