Skip to content

Accordion functionality in cards (articles) #679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

PacificBird
Copy link

@PacificBird PacificBird commented May 6, 2025

For one of my work projects I needed to implement cards with the functionality of accordions. The solution I found was extremely simple, and I believe that this is a very common use-case, so I thought I should make a fork and send the changes in.

This is how it looks open:
image

This is how it looks closed:
image

and this is what the HTML looks like:

<article>
   <details open="">
      <summary>
         <header> <h3 style="margin:0;">Account Details</h3> </header>
      </summary>
      <p><b>Username: </b>doe.john</p>
      <p><b>Email: </b>[email protected]</p>
      <p><b>Name: </b>John Doe</p>
      <p><b>Business: </b>PicoCSS</p>
      <p><b>Role: </b>Developer</p>
   </details>
</article>

Very simple to accomplish, looks nice, and requires next to no changes to the source code. The heaviest change here is a few lines to vertically align the chevron.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant