question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accordion in Angular adding collapse inside item

See original GitHub issue

Adding a collapse inside accordion to show or hide a certain fields / controls and adjust the height. In order to achieve this, I added a button that will trigger the collapse and a css

:host ::ng-deep .accordion-item:last-of-type { .accordion-collapse { height: auto !important; } } The collapse works with height set to auto, but when I click the toggle in accordion, all the controls disappear and it will not close.

  • Operating system and version (Windows 11)
  • Browser and version (Microsoft Edge)

image

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
32x0lfcommented, Nov 10, 2022

It works now. I updated to the latest version. Thanks a lot for helping.

0reactions
xidedixcommented, Nov 10, 2022

@32x0lf one more question - have you got imported SharedModule ?

I am not sure what you meant, Is that a core ui module?

That’s right

import {
  AccordionModule,
  ButtonModule,
  CollapseModule,
  FormModule,
  GridModule,
  SharedModule,
  SpinnerModule,
} from '@coreui/angular';

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    BrowserAnimationsModule,
    AccordionModule,
    ButtonModule,
    CollapseModule,
    FormModule,
    GridModule,
    SharedModule,
    SpinnerModule,
    ...
  ],
   ...
})
export class YourModule {}

see: https://stackblitz.com/edit/angular-ivy-yjkctj?file=src%2Fapp%2Fapp.component.scss,src%2Fapp%2Fapp.module.ts working example: https://stackblitz.com/edit/angular-ivy-yjkctj

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Expand or collapse accordion items on checkbox click ...
By default, accordion items expand or collapse by clicking the accordion item header or clicking expand/collapse icon in accordion header.
Read more >
Angular Bootstrap Accordion - examples & tutorial
The accordion uses collapse internally to make it collapsible. To render an accordion that's expanded, use [collapsed]="false" on accordion item. Basic example.
Read more >
Handle open/collapse events of Accordion in Angular
Here's a solution inspired by kjv's answer, which easily tracks which accordion element is open. I found difficult getting ...
Read more >
A simple but customizable accordion component in Angular
An input collapsing is taken from the user which defines the behavior of the accordion. It tells the accordion whether to close other...
Read more >
Expansion Panel | Angular Material
The <mat-expansion-panel-header> shows a summary of the panel content and acts as the control for expanding and collapsing. This header may optionally ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found