reapit / elements

Reapit Elements UI Component Library
https://elements.reapit.cloud/?path=/story/welcome--page
0 stars 2 forks source link

v5 component refactor: Accordion #133

Open willmcvay opened 1 month ago

willmcvay commented 1 month ago

Abstract

As part of the v5 Elements release, each component will be reviewed and refactored to ensure best practice and design system alignment

Specification

Developer Checklist

Release Checklist

Additional Context or Information

kurtdoherty commented 1 month ago

suggestion: I think it would be great to see us use the native HTML details element for the Accordion, particularly because it will provide all the correct a11y out-of-the-box for us, but also because it can handle groups of accordions at the DOM level, which provides CSS-only consumers a comparable experience to React users.

suggestion: I also think it would be great to move away from the items prop and towards a more JSX-centric API. As a very rough draft, I mean something like...

<Accordion.Group>
  <Accordion>
    <Accordion.Header>Foo</Accordion.Header>
    <Accordion.Body>Bar</Accordion.Body>
  </Accordion>
  ...
</Accordion.Group>

note: a quick and dirty POC of the above two suggestions is available here