Hi, I’m using a custom icon within my accordion by adding the class ion-accordion-toggle-icon
to an IonIcon within a IonItem, within an IonAccordion. The new icon is showing up as expected, but when it is expanded I need it to rotate 90 deg instead of 190 deg. It doesn’t look like there’s an attribute for controlling this, but I figured I could do it with CSS since there is an accordion-expanded
class that gets applied to the accordion component. No matter what I try I’m not able to get a selector to apply styles to the icon within though.
I’ve tried straight CSS like this:
.accordion-expanded > [slot="header"] .ion-accordion-toggle-icon
And I’ve tried using the shadow part for the accordion like this:
ion-accordion::part(header expanded) .ion-accordion-toggle-icon
Neither of those worked. Anyone have a suggestion on how to make this work?
Also, is it just not possible to access elements through an ionic shadow part, like i’m trying to do here?
Here is the React code I’m using for the accordion:
<IonAccordion color={color} toggleIconSlot={toggleIconSlot} value={accordionValue}>
<IonItem color={color} data-test="accordion-item" lines="none" slot="header">
{header}
<IonIcon
className="ion-accordion-toggle-icon"
color={color}
icon={IconList.chevronRight as IconName}
slot={toggleIconSlot}
/>
</IonItem>
{content}
</IonAccordion>
Thanks!