← All elements

Settings Panel Accordion

by @admin · 0 views

<div class="spa"><details open><summary><span>Notifications</span></summary><div><label>Email <input type="checkbox" checked></label><label>Push <input type="checkbox"></label></div></details><details><summary><span>Privacy</span></summary><div><label>Public profile <input type="checkbox" checked></label></div></details><details><summary><span>Sound</span></summary><div><label>Click sounds <input type="checkbox"></label></div></details></div>

About this accordion

A dark settings list whose rows expand to reveal options, with a plus icon that turns into a minus.

How it works

The rows are details elements in a dark card. The icon on each summary is two gradient bars forming a plus sign. When a row opens, the vertical bar shrinks to nothing and the icon rotates, so the plus turns into a minus with one transition. The options inside are ordinary labelled checkboxes.

Ways to customise it

  • Change #38bdf8 for the icon and checkbox accent.
  • Add rows by copying a whole details block.
  • Add the open attribute to choose which row starts expanded.

Good to know

The checkboxes are real inputs inside labels, so tapping the text toggles them. Connect them to your own settings storage, because CSS alone does not remember choices after a reload.

Open an example, copy the HTML and the CSS, and paste them into your page. There is nothing to install and no JavaScript to load.

More in Accordion

View all →