Skip to main content

Usage

Assemble the accordion directives in your template.

API Reference

The following directives are available to import from the @ng-primitives/ng-primitives/accordion package:

NgpAccordionDirective

single | multiple
default:"single"
Define whether only one or multiple accordion items can be open at a time.
boolean
default:"false"
Define an accordion can be collapsed. This is only applicable when ngpAccordionType is set to single.
T | T[]
Define the expanded accordion items. This should be a single value when ngpAccordionType is set to single and an array when set to multiple.
boolean
default:"false"
Define whether the accordion is disabled.
horizontal | vertical
default:"vertical"
Define the orientation of the accordion.
T | T[]
Emitted when the expanded accordion items change. This will be a single value when ngpAccordionType is set to single and an array when set to multiple.

NgpAccordionItemDirective

T
required
Define the value of the accordion item.
boolean
default:"false"
Define whether the accordion item is disabled.

NgpAccordionTriggerDirective

There are no inputs or outputs for this directive.

NgpAccordionContentDirective

There are no inputs or outputs for this directive.

Global Configuration

You can configure the default options for all accordions in your application by using the provideNgpAccordionConfig function in a providers array.

NgpAccordionConfig

single | multiple
Define whether only one or multiple accordion items can be open at a time.
boolean
Define an accordion can be collapsed. This is only applicable when type is set to single.
horizontal | vertical
Define the orientation of the accordion.

Schematics

You can use our schematic to generate a new accordion component.

Options

string
The name of the component.
string
The name of the project to add the component to.
string
The path to create the component.