springload/react-accessible-accordion

change accordion button color when panel is active

razked opened this issue · 2 comments

Hi i would like to change the accordion button text color when the panel is open. is there a way to achive this ?
tnx.

you could use CSS

.accordion__button[aria-expanded='true'],
.accordion__button[aria-selected='true'] {
    color: red
}

or AccordionItemState

            <AccordionItemButton>
                This item is 
                <AccordionItemState>
                    {({ expanded }) => (expanded ? 'expanded' : 'collapsed')}
                </AccordionItemState>
            </AccordionItemButton>

Hope that answers your question and I'm just closing this ticket for now, but please reopen to discuss further