Pivot Docs

    Accordion Elevated

    pivot-accordion-elevated is a container web component that groups pivot-accordion-item elements with elevated card styling. Only one item can be open at a time. For the default list accordion where multiple items can be open, use pivot-accordion-default.


    Quick Start

    <pivot-accordion-elevated>
    <pivot-accordion-item pivot-item-label="Section 1">
    <p>Content for section 1</p>
    </pivot-accordion-item>
    <pivot-accordion-item pivot-item-label="Section 2">
    <p>Content for section 2</p>
    </pivot-accordion-item>
    </pivot-accordion-elevated>

    Using the default slot

    The default (unnamed) slot is the only slot pivot-accordion-elevated renders. It is designed to accept pivot-accordion-item elements.

    Every time slotted content changes (slotchange), pivot-accordion-elevated re-scans its pivot-accordion-item descendants to apply pivot-surface="elevated", renumber pivot-step (when pivot-type="numbered"), and recompute the pivot-next-open attribute used for adjacent-border management (see below). Items can be added, removed, or reordered dynamically without manual re-initialization.

    The border-management logic depends on previousElementSibling, so it only affects items that are direct siblings of one another.


    Surface Propagation

    pivot-accordion-elevated sets pivot-surface="elevated" on every pivot-accordion-item inside it, including items added after initial render. This attribute is what triggers the elevated card styling inside each item:

    • Rounded corners on the container
    • Box shadow when expanded
    • Bottom margin when expanded, to separate from adjacent items
    • Transparent header border when expanded

    pivot-surface is parent-managed and should not be set manually on items.


    Numbered Type

    Set pivot-type="numbered" to show a step number before each item’s label:

    <pivot-accordion-elevated pivot-type="numbered">
    <pivot-accordion-item pivot-item-label="Step one">...</pivot-accordion-item>
    <pivot-accordion-item pivot-item-label="Step two">...</pivot-accordion-item>
    </pivot-accordion-elevated>

    pivot-accordion-elevated sets pivot-step on each child item based on its position (starting at 1), and updates the numbers when items are added, removed, or reordered. Switching pivot-type back to default removes the numbers. Like pivot-surface, pivot-step is parent-managed and should not be set manually.


    Single-Open Behavior

    Only one item can be open at a time. pivot-accordion-elevated listens for the pivot-accordion-item-toggle event (see the Accordion Item README for the detail shape) on its slot. When an item reports that it just opened, every other item in the group is closed by clearing its pivotOpen property and pivot-open attribute.

    Because this is driven by the toggle event, it only applies to items opened through their header button. Setting pivot-open or pivotOpen on an item from script does not dispatch the event, so the other items stay open and the adjacent item border is not recalculated. Set pivot-open on at most one item in markup, and avoid opening items from script inside this container.


    Adjacent Item Border

    The bottom border of an item is hidden when the immediately following sibling is open, preventing a visual double-border between adjacent items. The border transitions back in when the following item collapses.

    This is managed via a pivot-next-open attribute that pivot-accordion-elevated sets and removes as open state changes, including on initial render for items with pivot-open set in markup. It should not be set manually.


    CSS Parts

    Name Description
    container The outer wrapper div element

    Accessibility

    pivot-accordion-elevated is an implicit grouping container and does not carry its own ARIA role — it renders a single <div part="container"> wrapping the slotted items. This matches the ARIA APG Accordion Pattern; the accessible name/role/value semantics (WCAG 4.1.2) are provided by the pivot-accordion-item elements inside it.

    Screen Reader Behavior

    Screen readers encounter each item’s header button individually, in document order; the container itself is not announced. With pivot-type="numbered", the step number renders inside the header button, so it becomes part of the button’s accessible name — for example, “1 Step one, button, collapsed.”

    When opening one item closes another, the closed item’s aria-expanded changes to "false", but that change is not announced; only the state of the button the user activated is read out.

    Keyboard Navigation

    pivot-accordion-elevated does not attach keyboard handlers itself. Arrow keys, Home, and End are handled within pivot-accordion-item (see its README), which queries its parent for sibling items — so pivot-accordion-elevated as the common parent makes traversal work across the group.

    Focus Management

    pivot-accordion-elevated does not manipulate focus, set tabindex, or trap focus. Closing other items on open does not move focus.


    Related Components

    • Accordion Default — list-styled container where multiple items can be open at once.
    • Accordion Item — the disclosure this container groups; see its README for per-item properties, the toggle event, and item-level accessibility.
    • Accordion Stand Alone — use if only one accordion is needed.

    References


    API Reference

    Props

    Name Type Default Description
    pivot-type "default" | "numbered" "default" The accordion type. `numbered` displays a step number on each item.

    Slots

    Name Description
    default Default slot; accepts `pivot-accordion-item` elements