Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Installation
npx nx g @spartan-ng/cli:ui accordion
ng g @spartan-ng/cli:ui accordion
Usage
Brain API
BrnAccordionContentComponent
Selector: brn-accordion-content
Inputs
Prop | Type | Default | Description |
---|---|---|---|
contentClass | ClassValue | - | The class to be applied to the content element. |
BrnAccordionItemDirective
Selector: [brnAccordionItem]
ExportAs: brnAccordionItem
Inputs
Prop | Type | Default | Description |
---|---|---|---|
isOpened | boolean | false | Whether the accordion item is opened or closed. |
BrnAccordionTriggerDirective
Selector: [brnAccordionTrigger]
BrnAccordionDirective
Selector: [brnAccordion]
ExportAs: brnAccordion
Inputs
Prop | Type | Default | Description |
---|---|---|---|
type | 'single' | 'multiple' | single | Whether the accordion is in single or multiple mode. |
dir | 'ltr' | 'rtl' | null | null | The direction of the accordion, either 'ltr' (left-to-right) or 'rtl' (right-to-left). |
orientation | 'horizontal' | 'vertical' | vertical | The orientation of the accordion, either 'horizontal' or 'vertical'. |
Helm API
HlmAccordionContentComponent
Selector: hlm-accordion-content
Inputs
Prop | Type | Default | Description |
---|---|---|---|
class | ClassValue | - | - |
HlmAccordionIconDirective
Selector: ng-icon[hlmAccordionIcon], ng-icon[hlmAccIcon]
Inputs
Prop | Type | Default | Description |
---|---|---|---|
class | ClassValue | - | - |
HlmAccordionItemDirective
Selector: [hlmAccordionItem],brn-accordion-item[hlm],hlm-accordion-item
Inputs
Prop | Type | Default | Description |
---|---|---|---|
class | ClassValue | - | - |
HlmAccordionTriggerDirective
Selector: [hlmAccordionTrigger]
Inputs
Prop | Type | Default | Description |
---|---|---|---|
class | ClassValue | - | - |
HlmAccordionDirective
Selector: [hlmAccordion], hlm-accordion
Inputs
Prop | Type | Default | Description |
---|---|---|---|
class | ClassValue | - | - |
Examples
Multiple and Opened
The type
input can be set to 'multiple' to allow multiple items to be opened at the same time.
The isOpened
input can be used to set the initial state of an accordion item.