Skip to content

EuiAccordion - allow user to control open state from the outside #3594

@mbondyra

Description

@mbondyra

I am implementing some changes for lens and using EuiAccordion.

image

I need to control the accordion from the outside because it has to change state to open when we search through the fields (see the screenshot, point 3). However, we still want to preserve the functionality of toggling it from the according header (eg.’ > available fields’) and that’s impossible once we control it from the outside (with a param forceState). I tried:

  • Adding onClick as a prop of Accordion, but it toggles the accordion even if we click on the internal content (eg. products.discount from the screenshot)
  • Adding onClick on buttonContent, but it doesn’t toggle when clicking on the accordion arrow ‘>’ and paddings areas.
  • Implementing provided onToggle handler that would modify external state, but it only fires as a callback on open and close so it will never be fired

I need a handler onAccordionClick etc that would allow me to add a function that would modify the external state when clicking on the top.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions