Kinetic Accordion

A panel that opens and closes with a spring, with a plus icon that turns into a cross.

  • <kt-kinetic-accordion>
  • Display
  • No framework

Kinetic Accordion

Pure native Web Components & Canvas 2D with zero external scripts.Automatically adjusts ink contrast for light, dark, and custom accents.

The code

Copy the Kinetic Accordion

Fastest: press Copy on the card above for one complete file. To build it into your own project, use the files below: the markup, the styles, this component’s script and the shared effects script (effects.js) that every component uses.

<kt-kinetic-accordion open title="Zero Runtime Dependencies" sfx="パカッ!">Pure native Web Components &amp; Canvas 2D with zero external scripts.</kt-kinetic-accordion>

<kt-kinetic-accordion title="Adaptive Monochrome Tokens" sfx="シュッ!">Automatically adjusts ink contrast for light, dark, and custom accents.</kt-kinetic-accordion>

Attributes

NameWhat it doesDefault
openPresent when expanded.—
titleHeading shown on the trigger.—
sfxSound-effect text on toggle.—

Keyboard and screen readers

  • The trigger is a button with aria-expanded.
  • Space or Enter opens and closes it.

Styling variables

Every look is a CSS variable: --kt-accent, --kt-accent-ink, --kt-radius-btn, --kt-surface-radius, --kt-surface-bg, --kt-border-w, --kt-comp-shadow and --font-sans. The copied file sets them all from your choices.

FAQ

Kinetic Accordion: questions answered

How do I use the Kinetic Accordion?

Press Copy on the card to get a complete HTML file, or copy the HTML, CSS and JavaScript tabs into your own page. In your markup the element is written as <kt-kinetic-accordion>.

Which attributes does <kt-kinetic-accordion> accept?

open, title, sfx. Each one is described in the attributes table on this page.

Is the Kinetic Accordion accessible?

The trigger is a button with aria-expanded. Space or Enter opens and closes it.

Can I change the Kinetic Accordion colors, corners and font?

Yes. Use the options on this page: accent color, border radius, background, border, shadow and Google font. The copied code already contains your choices, and every one of them is a CSS variable you can edit later.