Skip to main content

Accordion

shadow

The Accordion element allows you to view the contents in drop-down sections. Each section can be expanded or collapsed with a click, allowing users to quickly find and view the information they want. The component supports multiple selection, which means that multiple sections can be expanded at once. In addition, it allows you to set the initial index of the expanded section, which provides flexibility when initializing a component with default expanded content.

Basic use

Colours

Multiple

When to use

Use wje-accordion when you need a consistent WebJET-based implementation for this UI concern.

When not to use

Do not stretch the component beyond its responsibility; compose smaller primitives for edge cases.

Accessibility

Validate keyboard behavior, focus states, contrast, and meaningful labels for interactive elements.

Best Practices

  • Prefer component APIs over direct DOM manipulation.
  • Stick to design tokens and naming conventions.
  • Test components with realistic data before production rollout.

Attributes and Properties

multiple

DescriptionAllows multiple accordion items to be expanded at the same time.
Attributemultiple
Typeboolean
Default-

index

DescriptionSets the index of the currently active accordion item.
Attributeindex
Typenumber
Default-

disabled

DescriptionDisables user interaction with accordion items.
Attributedisabled
Typeboolean
Default-

expanded

DescriptionControls whether the accordion item is expanded.
Attributeexpanded
Typeboolean
Default-

Events

NameDescription
wje-accordion-item:openEmitted when the component is opened.

Methods

collapseAll

DescriptionMethod to run after the element is drawn.
Signature(exception: any) => void

getAccordions

DescriptionMethod to get the accordions.
Signature() => Array

CSS Shadow Parts

No CSS shadow parts available for this component.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

NameDescription
defaultDefault slot for the main component content.