Collapse
Collapse
, A content area which can be collapsed and expanded. Can be used to group or hide complex regions to keep the page clean.
Import
To utilize the Collapse component, import it from @vivakits/react-components
.
import { VKCollapse } from "@vivakits/react-components";
Default Collapse
An example of a Collapse with values.
All Tab Open
You can open all tabs by passing openAll
to VKCollapse
component.
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness.
it can be found as a welcome guest in many households across the world.
Size
You can handle different sizes collapse by set size
property to 'sm' 'md' 'lg' 'xl'
to VKCollapse
component.
Small
Medium
Large
Extra Large
Accordion
An example of a Collapse with accordion mode. In accordion mode, only one panel can be expanded at a time.
No arrow
You can hide arrow by passing hideArrow={true}
to VKCollapse
component.
Catch Event When Panel Change
An example of catch event while panel change.
API Reference
Attribute | Type | Description | Default |
---|---|---|---|
accordionMode | boolean | If true, Collapse renders as Accordion. In accordion mode, only one panel can be expanded at a time. | false |
activeTab | string | Key of the active panel | - |
openAll | boolean | Allow to open all tab initially | false |
destroyInactivePanel | boolean | Destroy Inactive Panel from DOM | false |
hideArrow | boolean | Allow to hide collapse icon | false |
expandIcon | ReactNode | Allow to customize collapse icon | - |
size | smmdlgxl | Set the size of collapse | md |
onChange | function | Callback function executed when active panel is changed | - |
items | [{ key: string, label: string, children: ReactNode }] | collapse items content | - |
collapseContainerClassName | string | Optional. Custom class name for collapse container. | - |
collapseSectionClassName | string | Optional. Custom class name for collapse section. | - |
collapseHeadingClassName | string | Optional. Custom class name for collapse Heading text. | - |
collapseItemContainerClassName | string | Optional. Custom class name for collapse's item container. | - |
collapseItemContentClassName | string | Optional. Custom class name for collapse's item content. | - |