Search...

Collapse

Contrast Angular Bootstrap Collapse

Contrast Angular Bootstrap Collapse is a component which toggles content. It is useful for grouping great amount of texts and/or graphics into collapsible items.

Contrast Angular Bootstrap Collapse is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the height from its current value to 0.

Importing the Contrast Angular Bootstrap Collapse Module

To use the Contrast Angular Bootstrap Collapse component in your project you need to import CollapseModule.

ts
import {CollapseModule } from 'cdbangular';

Default Collapse

Angular Bootstrap Collapse Default

HTML
html
<CDBBtn color="primary" style="margin-bottom: 1rem" (click)="content.toggleCollapse()">
COLLAPSE BUTTON
</CDBBtn>
<CDBCollapse #content="cdbCollapse">
<span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum
</span>
</CDBCollapse>

Opened Collapse

Angular Bootstrap Collapse Opened

HTML
html
<CDBBtn color="secondary" style="margin-bottom: 1rem" (click)="content2.toggleCollapse()">
COLLAPSE BUTTON
</CDBBtn>
<CDBCollapse #content2="cdbCollapse" [isOpen]=true>
<span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolor harum, molestias ducimus dolorem,
ipsa asperiores sequi quaerat quidem non eius facere vitae pariatur at voluptatibus sint blanditiis
facilis sunt accusamus quae quia voluptas, enim numquam! Maxime nulla omnis soluta sequi consequatur
iusto repudiandae obcaecati, eius numquam delectus veniam possimus fugiat qui nobis neque eveniet
quasi doloribus magnam amet nihil! Et perferendis ipsum repellat est deserunt. Mollitia labore
deserunt rerum nulla, at ratione, quis aperiam soluta atque beatae totam incidunt maxime voluptatem
fugit libero! Molestias tempore illo assumenda repellat atque commodi sint nam illum voluptate a
perspiciatis, delectus ex nesciunt harum! Lorem ipsum dolor sit amet consectetur adipisicing elit.
Vero deleniti quibusdam ex voluptas. Possimus autem facere natus a voluptas ad ipsum beatae
expedita, nemo nisi vero impedit eveniet nulla. Voluptates?
</span>
</CDBCollapse>

API

API Reference: Contrast Collapse Bootstrap Inputs

This section will build on your information about the props you get to use with the Contrast Angular Bootstrap Collapse component. You will find out what these props do, their default values, and how you would use them in your code. The table below lists the prop options for CDBCollapse component.

NameTypeDefaultDescriptionExample
classStringAdds custom classesclass="myClass"
delayNumber or Object{show: 350, hide: 350}Defines how many milliseconds the open/close event are delayeddelay={show: 3000, hide: 7000}
navbarBooleanfalseAdds navbar-collapse bootstrap class to class name propertynavbar=true
isOpenBooleanDefines if accordion is opened or closedisOpen=true
onOpenedfunctionDefines the function which fires when Accordion has openedonOpened={yourFunction}
onClosedfunctionDefines the function which fires when Accordion has closedonClosed={yourFunction}

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.