On this page
Angular Accordion Component
Build vertically collapsing accordions in combination with our Angular Collapse component.
Examples
Click the accordions below to expand/collapse the accordion content.
This is the first item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.Loading...
Loading...
Flush
Addflush
to remove the defaultbackground-color
, some borders, and some rounded corners to render accordionsedge-to-edge with their parent container.
This is the first item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.Loading...
Loading...
Always open
Make accordion items stay open when another item is opened.
This is the first item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the
.accordion-body
, though the transition does limit overflow.Loading...
Loading...
API
Accordion Module
import { AccordionModule, SharedModule } from '@coreui/angular';@NgModule({ imports: [ AccordionModule, SharedModule ]})export class AppModule(){}
c-accordion
component
Inputs
name | description | type | default |
---|---|---|---|
flush | Removes the default background-color, some borders, and some rounded corners to render accordions edge-to-edge with their parent container. | boolean | undefined |
alwaysOpen | Make accordion items stay open when another item is opened | boolean | undefined |
c-accordion-item
component
Inputs
name | description | type | default |
---|---|---|---|
visible | Toggle an accordion item programmatically | boolean | false |
cAccordionButton
directive
Inputs
name | description | type | default |
---|---|---|---|
collapsed | Toggles an accordion button collapsed state. Use in accordionHeaderTemplate. | boolean | undefined |
Shared Module
cTemplateId
directive
prop | type | default | description |
---|---|---|---|
cTemplateId | string | undefined | template name to render |
templates:
template id | description |
---|---|
accordionHeader | header content only |
accordionBody | body content only |
accordionHeaderTemplate | header full template |
accordionBodyTemplate | body full template |
internals:
AccordionService
service
prop | type | default | description |
---|---|---|---|
items | AccordionItemComponent[] | [ ] | array of accordion items |
alwaysOpen | boolean | false | in sync withAccordionComponent.alwaysOpen prop |