1.0.0 • Published 1 year ago

ngx-collapse-animated v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

NgxCollapseAnimated

Bootstrap-like collapse for Angular

Try it https://stackblitz.com/~/github.com/AlexKhymenko/ngx-collapse-animated

Installation

  • Simply run npm i ngx-collapse-animated.
  • Add animation provideAnimations provider to your project
bootstrapApplication(AppComponent, {
                      providers: [provideAnimations(),
                                  provideZoneChangeDetection({ eventCoalescing: true }),
                                  provideRouter(routes)]
}).catch((err) => console.error(err));
  
  • Add the following css in styles.scss of your application
.collapse:not(.show) {
  display: none;
}

.collapsing {
  height: 0;
  overflow: hidden;
  transition: height 0.35s ease;
}

or import scss file

  @use 'ngx-collapse-animated';

Usage

Add ngxCollapseAnimated directive to where the content should be visible

  <main class="container">
  <div class="item">
    <button (click)="visible = !visible">Show animation</button>
    <div [ngxCollapseAnimated]="visible">
      Hello to You!
    </div>
  </div>
</main>

Import NgxCollapseAnimatedDirective in Your component

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RouterOutlet, NgxCollapseAnimatedDirective],
  templateUrl: './app.component.html',
  styleUrl: './app.component.css'
})
export class AppComponent {
  title = 'collapse-animated';

  visible = true;
}
1.0.0

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago