Styling "Lost Focus" Header

I need to style the header of an expanded accordion, but not the current active accordion, like so:




As you can see I managed to style everything else, but I have not been able to style the header after the user clicks and expands a different header. 

For reference, yellow is the active header.

Below is the class signature I found in the debug console, but even setting this value, along with !important doesn't affect the "non active, expanded" header.

.e-acrdn-item.e-select.e-selected.e-active {
background-color: #00d1b2;
}


8 Replies 1 reply marked as answer

AK Alagumeena Kalaiselvan Syncfusion Team July 13, 2020 12:19 PM UTC

Hi David, 

Thanks for contacting Syncfusion support. 

We have checked your reported case “Style the header of an expanded Accordion” and we suggest you to override the below CSS classes to apply the background color to the expanded accordion header even the user clicks and expands different accordion header. Refer the below styles for that. 

<style> 
    .e-accordion .e-acrdn-item .e-acrdn-header:active, 
    .e-accordion .e-acrdn-item.e-select.e-selected.e-active > .e-acrdn-header { 
        background-color: #00d1b2 !important;    // To apply background color for the expanded accordion header 
    } 
</style> 

Also, you can download the sample from the link. 

Kindly get back to us, if you need further assistance. 

Regards 
Alagumeena.K 



DA David July 13, 2020 03:43 PM UTC

Hello Alagumeen,

Thank you for your reply. This did not fix my issue however.

The yellow header you see in the first image is correct. It is only the light gray header that is incorrect.

The code you have given me overrides both of these values, such that the expanded, non-focused header does indeed change to whatever color I set, but it also changes the yellow "active, focused" header to the same color and thus, does not fit my requirements.

Please test the code prior to replying. Again it is the white/grey "non-active, non-focused" but still expanded header that I need to style specifically. Your code overrides all the expanded headers at once.

Thanks!



AK Alagumeena Kalaiselvan Syncfusion Team July 14, 2020 01:57 PM UTC

Hi David, 

Thanks for your update. 

We couldn’t conclude your requirements. As per our understanding, we have listed your requirements based on your updates and shared images. 

Could you please check and confirm your requirements? We will provide a solution or application as early as possible once you confirmed. 
  • Light/gray for non-focused accordion headers
  • Yellow for focused and expanded header
  • A custom(separate) style for remaining expanded headers
Regards 
Alagumeena.K 



DA David July 14, 2020 02:38 PM UTC

I will try and make it clearer than I already have:


The yellow header, circled in GREEN is styled correctly.

They grey header, with the
RED arrow is not the color I want it to be. I need that header to be BLACK.

Of the two expanded items that you see in the picture, the user has clicked on them as follows:

The top header was clicked first. This expanded that item, and styled that header correctly in
YELLOW.
When the second item is clicked and expanded, which is the current state you see in the above picture, the newly expanded accordion item header gets styled in YELLOW, which is correct.

However, the first item that was expanded, and is still expanded, but no longer active, changes its header color to the grey that you see in this picture.

This behaviour is what I need to style. I need that header's background to go back to black.

The code you provided me does not do this. The code you provided me overrides the colour of all expanded accordion items.

That means it turns both the grey header and the yellow header black. That is not what I need. I need to style only that grey header, which is the header of an item that is still expanded, but no longer the item that is active, since the user has gone and expanded a different item, which is what triggers the original expanded item's header to go from yellow, to grey.



NR Nevitha Ravi Syncfusion Team July 15, 2020 07:01 AM UTC

Hi David, 

Thanks for the clarification and regret for the inconvenience. 

We have changed the CSS in our previous sample to set yellow color for the currently expanded accordion panel alone and black to other expanded panels as per your requirement. The sample can be downloaded from the following ink. 

<style> 
    .e-accordion .e-acrdn-item.e-select.e-selected.e-expand-state > .e-acrdn-header { 
        background-color: yellow !important; 
    } 
 
    .e-accordion .e-acrdn-item.e-select.e-active.e-selected:not(.e-expand-state) > .e-acrdn-header    { 
        background-color: black !important; 
    } 
</style> 
 
Note: ‘e-expand-state’ class is added for currently clicked accordion panel irrespective of expanded or non-expanded. For expanded panels, you can check with ‘e-selected’ class. 
 
Kindly let us know for further queries. 
 
Regards, 
Nevitha 


Marked as answer

DA David July 15, 2020 06:33 PM UTC

Hello Nevitha,

This did fix my issue and I was able to style the menu the way I needed to, thank you.


DA David July 15, 2020 09:06 PM UTC

I have a few more styling issues that I can't seem to track down:

First is the unselected, normal accordion item's header color:
I managed to find how to color the icon, but it isn't the same selector as the text apparently.

These next two scenarios only occur on an accordion item header that is selected, whether expanded or not:



As you can see here, on hover the arrow icon is blue, when it should be black, like the text.


This image is how it looks selected, but not in hovered state.

The colors are correct, but there is a text-decoration that isn't supposed to be there.

Again both of the last two scenarios occur whether that item is expanded or collapsed, so long as it is selected.

Thanks!



AK Alagumeena Kalaiselvan Syncfusion Team July 16, 2020 01:58 PM UTC

Hi David, 

Thanks for your update. 

We have checked your reported scenarios and we listed the accordion items with some possibilities to customize the header and toggle icon color. Refer the below table for that. 

Accordion status 
Overridden CSS class  
Unselected Accordion item  
.e-accordion .e-acrdn-item .e-acrdn-header .e-acrdn-header-content { 
        color: black !important;  // To customize header color 
} 
.e-accordion .e-acrdn-item.e-select > .e-acrdn-header > .e-toggle-icon { 
        color: black !important;   // To customize toggle icon color 
 } 
Accordion item which selected and currently expanded 
.e-accordion .e-acrdn-item.e-select.e-selected.e-expand-state > .e-acrdn-header .e-acrdn-header-content { 
        color: red !important;  // To customize header color 
 } 
.e-accordion .e-acrdn-item.e-select.e-selected.e-expand-state > .e-acrdn-header > .e-toggle-icon { 
        color: red !important;   // To customize toggle icon color 
 } 
Accordion item which is expanded but inactive 
.e-accordion .e-acrdn-item.e-select.e-selected:not(.e-expand-state) > .e-acrdn-header .e-acrdn-header-content { 
        color: blue !important;   // To customize header color 
    } 
.e-accordion .e-acrdn-item.e-select.e-selected:not(.e-expand-state) > .e-acrdn-header > .e-toggle-icon { 
        color: blue !important;   // To customize toggle icon color 
    } 
Accordion item which is active and collapsed 
.e-accordion .e-acrdn-item.e-select.e-expand-state:not(.e-selected) > .e-acrdn-header .e-acrdn-header-content { 
        color: gray !important   // To customize header color 
    } 
    .e-accordion .e-acrdn-item.e-select.e-expand-state:not(.e-selected) > .e-acrdn-header > .e-toggle-icon { 
        color: gray !important   // To customize toggle icon color 
    } 

Also, we have modified the shared sample for your reference. 

Please make use of above CSS classes which is suitable to your scenario and get back to us, if you need further assistance. 

Regards 
Alagumeena.K 


Loader.
Up arrow icon