Skip to content

ui: Accordion widget - Add 'multi' option#5510

Merged
stevegolton merged 2 commits intomainfrom
dev/sg/accordion-multi
Apr 21, 2026
Merged

ui: Accordion widget - Add 'multi' option#5510
stevegolton merged 2 commits intomainfrom
dev/sg/accordion-multi

Conversation

@stevegolton
Copy link
Copy Markdown
Member

@stevegolton stevegolton commented Apr 20, 2026

Accordion widget currently only allows one section to be open at one time (by design - this is a feature).

It can be handy to be able to open and close multiple sections at once.

This patch adds a 'multi' option, to enable this behavior, and also allows each section to be start open with a defaultOpen prop.

This patch also refactors the Accordion widget to use a composite component approach:

m(Accordion,
  m(AccordionSection, {header: 'Foo'}, 'Foo content'),
  m(AccordionSection, {header: 'Bar'}, 'Bar content'),
)

@stevegolton stevegolton requested a review from aMayzner April 20, 2026 15:57
@stevegolton stevegolton requested a review from a team as a code owner April 20, 2026 15:57
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

Comment thread ui/src/widgets/accordion.ts Outdated
- Use <details>.
- Use composite component pattern (Accordion + many AccordionSections inside) which makes use of the context to inject the shared name if used in mutli mode.
- Add defaultOpen option to each Section which allows controlling which sections are open initially.
- Style the header focus ring
@stevegolton stevegolton force-pushed the dev/sg/accordion-multi branch from 274e2f6 to a4208ec Compare April 21, 2026 11:21
Comment thread ui/src/widgets/accordion.ts Dismissed
@stevegolton stevegolton enabled auto-merge (squash) April 21, 2026 11:23
@stevegolton stevegolton disabled auto-merge April 21, 2026 11:24
@stevegolton stevegolton enabled auto-merge (squash) April 21, 2026 11:25
@stevegolton stevegolton merged commit 617d7d5 into main Apr 21, 2026
24 of 25 checks passed
@stevegolton stevegolton deleted the dev/sg/accordion-multi branch April 21, 2026 11:27
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.

3 participants