Style in React Accordion

04 Sep 20262 minutes to read

The following content provides the exact CSS structure that can be used to modify the control’s appearance based on user preference.

Customizing React Accordion

Use the following CSS to customize the Accordion.

.e-accordion {
    border: 5px solid rgb(173, 255, 47);
}

Customizing the list items

The following CSS styles each React Accordion item. Because .e-acrdn-item wraps both the header and the content region, the color and background-color set here are inherited by both unless you override the header or content separately.

.e-accordion .e-acrdn-item {
    text-align: center;
    color: pink;
    background-color: #2fa1ff;
}

Customizing the React Accordion’s header

Use the following CSS to customize the header of React Accordion control.

.e-accordion .e-acrdn-item > .e-acrdn-header {
    background: #2fa1ff !important;
    justify-content: center;
}

Customizing the React Accordion’s expand and collapse icons

The following CSS changes the color of the expand and collapse toggle icons.

.e-accordion .e-acrdn-item .e-acrdn-header .e-toggle-icon .e-icons {
     color: pink;
}

Customizing the hover state of the React Accordion control

The following CSS adds a border to an item header when the pointer hovers over it.

.e-accordion .e-acrdn-item .e-acrdn-header:hover {
    border: 2px solid gray;
}

Customizing the selected item of the React Accordion control

Customizing the selected item background

The following CSS changes the background color of an expanded (e-active) or focused (e-item-focus) item header.

.e-accordion .e-acrdn-item.e-select.e-active > .e-acrdn-header,
.e-accordion .e-acrdn-item.e-select.e-item-focus > .e-acrdn-header {
    background-color: rgb(0, 15, 100) !important;
}

Customizing the selected item text

The following CSS changes the text color of the expanded or focused item header.

.e-accordion .e-acrdn-item.e-select.e-active > .e-acrdn-header .e-acrdn-header-content,
.e-accordion .e-acrdn-item.e-select.e-item-focus > .e-acrdn-header .e-acrdn-header-content {
    color: #2fa1ff !important;
}