Skip to content
Bitsy UI 0.x
Theme
Menu: Accordion
  1. Docs
  2. Bits

Accordion

Accordion shows and hides headed sections of content. It is native details and summary with a drawn chevron, one root hook, three part hooks, and a boxed variant, with no JavaScript.

Public web API

One root hook, an item on each <details>, a trigger on its <summary>, and a content wrapper.

<div data-bitsy-accordion>
  <details data-bitsy-accordion-item name="faq" open>
    <summary data-bitsy-accordion-trigger><h3>Can I change plans later?</h3></summary>
    <div data-bitsy-accordion-content>
      <p>Yes. Changes apply at the start of the next billing period.</p>
    </div>
  </details>
</div>
  • Share one name across items so opening one closes the others. Omit it to allow many open.
  • Add open to the item that starts open.
  • data-bitsy-variant="boxed" on the root draws each item as a panel.
  • Keep links and buttons out of the trigger.

Variants and modes

The chevron direction shows the state, so open and closed never rely on color alone.

Default, many open

Can I change plans later?

Yes. Changes apply at the start of the next billing period.

Do you offer refunds?

Within 30 days of purchase, for any reason.

Which payment methods do you accept?

Cards, bank transfer, and invoices for annual plans.

Boxed, one open at a time

Install

Add the stylesheet to your page.

Configure

Set the hooks you want to change on the root.

Ship

  • Run the build
  • Deploy
Single disclosure
Advanced options

Extra settings for people who need them.

Foundation versus Bit

A plain <details> gets the foundation panel look, with a boxed frame and a small chevron at the start. data-bitsy-accordion adds the dividers or panels, the chevron, hover feedback, and the height animation where the browser supports it. Toggling, keyboard, and find-in-page are native, so the Bit ships no JavaScript.

Bitsy UI is MIT licensed. Source on GitHub.