Return to Sky UI homepage
import { Accordion } from '@sky-uk/ui-core';

Props

id

The id attribute sets the appropriate aria attributes to provide semantic relationship between the Heading and Content.

<Accordion id="example-id">

The id is essential for the Accordion to function correctly and must be a unique value when multiple Accordions are used on a page.

$isOpen

Set the initial state of the Accordion.

$headingLevel

The $headingLevel prop allows you to set the heading level of the Accordion. This is useful for accessibility and SEO purposes.

Subcomponents

  • Accordion.Heading - the heading accepts onBlur, onFocus, onMouseEnter and onMouseLeave to trigger additional actions.
  • Accordion.Content - container for content which handles the open/closed state.

Callbacks

The onOpen and onClose callbacks can be used to trigger additional actions when the Accordion is opened or closed.

Presentation

Some designs call for an Accordion with container styles applied. You can achieve this by wrapping the Accordion inside of a Box component as demonstrated below.

Bordered

Drop Shadow

System Modifiers

The Accordion component also supports the props applied using the following system modifiers: