Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Yes. It adheres to the WAI-ARIA design pattern.
Yes. It comes with default styles that match the other components' aesthetics.
Yes. It's animated by default, but you can disable it if you prefer.
import { Component } from '@angular/core';
import {
BrnAccordionComponent,
BrnAccordionContentComponent,
BrnAccordionItemComponent,
BrnAccordionTriggerComponent,
} from '@spartan-ng/ui-accordion-brain';
import {
HlmAccordionContentDirective,
HlmAccordionDirective,
HlmAccordionIconComponent,
HlmAccordionItemDirective,
HlmAccordionTriggerDirective,
} from '@spartan-ng/ui-accordion-helm';
@Component({
selector: 'spartan-accordion-preview',
standalone: true,
imports: [
BrnAccordionComponent,
BrnAccordionContentComponent,
BrnAccordionItemComponent,
BrnAccordionTriggerComponent,
HlmAccordionDirective,
HlmAccordionItemDirective,
HlmAccordionTriggerDirective,
HlmAccordionContentDirective,
HlmAccordionIconComponent,
],
template: `
<brn-accordion hlm>
<brn-accordion-item hlm>
<brn-accordion-trigger hlm>
<span>Is it accessible?</span>
<hlm-accordion-icon />
</brn-accordion-trigger>
<brn-accordion-content hlm> Yes. It adheres to the WAI-ARIA design pattern.</brn-accordion-content>
</brn-accordion-item>
<brn-accordion-item hlm>
<brn-accordion-trigger hlm>
<span>Is it styled</span>
<hlm-accordion-icon />
</brn-accordion-trigger>
<brn-accordion-content hlm>
Yes. It comes with default styles that match the other components' aesthetics.
</brn-accordion-content>
</brn-accordion-item>
<brn-accordion-item hlm>
<brn-accordion-trigger hlm>
<span>Is it animated?</span>
<hlm-accordion-icon />
</brn-accordion-trigger>
<brn-accordion-content hlm>
Yes. It's animated by default, but you can disable it if you prefer.
</brn-accordion-content>
</brn-accordion-item>
</brn-accordion>
`,
})
export class AccordionPreviewComponent {}
Installation
npx nx g @spartan-ng/nx:ui accordion
Usage
import {
BrnAccordionComponent,
BrnAccordionContentComponent,
BrnAccordionItemComponent,
BrnAccordionTriggerComponent,
} from '@spartan-ng/ui-accordion-brain';
import {
HlmAccordionContentDirective,
HlmAccordionDirective,
HlmAccordionIconComponent,
HlmAccordionItemDirective,
HlmAccordionTriggerDirective,
} from '@spartan-ng/ui-accordion-helm';
<brn-accordion hlm>
<brn-accordion-item hlm>
<brn-accordion-trigger hlm>
<span>Is it accessible?</span>
<hlm-accordion-icon />
</brn-accordion-trigger>
<brn-accordion-content hlm>
Yes. It adheres to the WAI-ARIA design pattern.
</brn-accordion-content>
</brn-accordion-item>
</brn-accordion>