The Accordion is a vertically collapsible content panel that displays one or more panels at a time within the available space.
<div id='accordion'/>
<script>
var accordionObj = new Accordion();
accordionObj.appendTo('#accordion');
</script>
AccordionAnimationSettingsModel
Specifies the animation configuration settings for expanding and collapsing the panel.
Defaults to { expand: { effect: ‘SlideDown’, duration: 400, easing: ‘linear’ },collapse: { effect: ‘SlideUp’, duration: 400, easing: ‘linear’ }}
Object[]
Specifies the datasource for the accordion items.
Defaults to []
boolean
Specifies whether to enable the rendering of untrusted HTML values in the Accordion component. When this property is enabled, the component will sanitize any suspected untrusted strings and scripts before rendering them.
Defaults to true
boolean
Enable or disable persisting component’s state between page reloads.
Defaults to false
boolean
Enable or disable rendering component in right to left direction.
Defaults to false
Specifies the options to expand single or multiple panel at a time. The possible values are:
Single
: Sets to expand only one Accordion item at a time.Multiple
: Sets to expand more than one Accordion item at a time.Defaults to ‘Multiple’
number[]
Specifies the expanded items at initial load.
Defaults to []
string
| Function
Specifies the header title template option for accordion items.
Defaults to null
string
| number
Specifies the height of the Accordion in pixels/number/percentage. Number value is considered as pixels.
Defaults to ‘auto’
string
| Function
Specifies the template option for accordion items.
Defaults to null
An array of item that is used to specify Accordion items.
let accordionObj: Accordion = new Accordion( {
items: [
{ header: 'Accordion Header', content: 'Accordion Content' }]
});
accordionObj.appendTo('#accordion');
Defaults to []
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ”
string
| number
Specifies the width of the Accordion in pixels/number/percentage. Number value is considered as pixels.
Defaults to ‘100%’
Adds the handler to the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event |
handler | Function |
Specifies the call to run when the event occurs. |
Returns void
Adds new item to the Accordion with the specified index of the Accordion.
Parameter | Type | Description |
---|---|---|
item | AccordionItemModel | AccordionItemModel[] | Object | Object[] |
Item array that is to be added to the Accordion. |
index (optional) | number |
Number value that determines where the item should be added. By default, item is added at the last index if the index is not specified. |
Returns void
Appends the control within the given HTML element
Parameter | Type | Description |
---|---|---|
selector (optional) | string | HTMLElement |
Target element where control needs to be appended |
Returns void
Adding unload event to persist data when enable persistence true
Returns void
When invoked, applies the pending property changes immediately to the component.
Returns void
Removes the control from the DOM and also removes all its related events.
Returns void
Removing unload event to persist data when enable persistence true
Returns void
Enables/Disables the specified Accordion item.
Parameter | Type | Description |
---|---|---|
index | number |
Number value that determines which item should be enabled/disabled. |
isEnable | boolean |
Boolean value that determines the action as enable (true) or disable (false). If the isEnable value is true, the item is enabled or else it is disabled. |
Returns void
Expands/Collapses the specified Accordion item.
Parameter | Type | Description |
---|---|---|
isExpand | boolean |
Boolean value that determines the action as expand or collapse. |
index (optional) | number |
Number value that determines which item should be expanded/collapsed.index is optional parameter.Without Specifying index, based on the isExpand value all Accordion item can be expanded or collapsed. |
Returns void
Returns the persistence data for component
Returns any
Returns the route element of the component
Returns HTMLElement
Handling unload event to persist data when enable persistence true
Returns void
Shows or hides the specified item from Accordion.
Parameter | Type | Description |
---|---|---|
index | number |
Number value that determines which item should be hidden/shown. |
isHidden (optional) | boolean |
Boolean value that determines the action either hide (true) or show (false). Default value is false. If the isHidden value is false, the item is shown or else item it is hidden. |
Returns void
Applies all the pending property changes and render the component again.
Returns void
Removes the handler from the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event to remove |
handler | Function |
Specifies the function to remove |
Returns void
Dynamically removes item from Accordion.
Parameter | Type | Description |
---|---|---|
index | number |
Number value that determines which item should be removed. |
Returns void
Sets focus to the specified index item header in Accordion.
Parameter | Type | Description |
---|---|---|
index | number |
Number value that determines which item should be focused. |
Returns void
Dynamically injects the required modules to the component.
Parameter | Type | Description |
---|---|---|
moduleList | Function[] |
? |
Returns void
The event will be fired while clicking anywhere within the Accordion.
EmitType<Event>
The event will be fired once the control rendering is completed.
EmitType<Event>
The event will be fired when the control gets destroyed.
The event will be fired after the item gets collapsed/expanded.
The event will be fired before the item gets collapsed/expanded.