Altinn / app-frontend-react

Altinn application React frontend
BSD 3-Clause "New" or "Revised" License
18 stars 32 forks source link

Be able to use the Accordion component from Felles Designsystem #1285

Closed mikaelrss closed 1 year ago

mikaelrss commented 1 year ago

Description

We want to be able to display information with the use of the Accordion component from @digdir/design-system-react.

Proposed techincal solution

This needs to be solved as a new component Can be solved by providing an option to Group and RepeatingGroup which implements the Accordion component from @digdir/design-system-react.

The new component behaviour of Group and RepeatingGroup should:

After discussing this with the apps team, we have decided that we will introduce two new components. Accordion and AccordionGroup.

Accordion

Accordion would be a single stand alone component which can have a title and some contents in a body. The contents of the body should be comprised of other Altinn 3 components. If the Accordion should contain only text, this should be solved with placing a Paragraph inside it. There will be some contraints on what content could go into an Accordion. The title of the Accordion will be provided via textResourceBindings.

Closed state: image

Open state: image

AccordionGroup

AccordionGroup should be a component that groups Accordion components together. The only content that would be allowed to place inside an AccordionGroup is Accordions.

image

Additional Information

The accordion component from digdir's design system

mikaelrss commented 1 year ago

The Accordion component from the design system does not seem to react to height changes of the contents. This means that if app developers put content with dynamic heights inside, the Accordion will behave like this: image

and this: image

We should therefore limit the Accordion to be able to contain only elements that we are sure will not resize.