Skip to main content
Neighborhood Design System v5.1.0

Accordion Item

Draft

An Accordion Item is a single expandable section with its own header and content, used within an Accordion.

Storybook docs (opens in new tab)
Draft. This component is in draft. Its API may change before it is marked Ready. What this means

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdAccordionItem } from '@fbin-web/neighborhood-core';
Usage
<nbhd-accordion-item header="Accordion Item">
  <nbhd-text>
    This is the content of the accordion item. <a href="#">This is a link</a>.
  </nbhd-text>
</nbhd-accordion-item>

Usage

  • Use as a child within an Accordion. Each Accordion Item represents one expandable section and manages its own header, content, and expanded state.

Properties

PropertyAttributeTypeDefaultDescription
expandedexpandedbooleanfalseControls whether the accordion item is expanded or collapsed.
iconiconchevronplus-minuschevronThe icon type to display in the header.
headingLevelheading-level1234563Heading level wrapping the item header, so screen reader users can jump between sections by heading. Match it to the page outline.
headerheaderstring—The header text for the accordion item. Falls back to the header slot content when omitted.

Events

NameDescriptionEvent Detail
nbhd-accordion-toggleEmitted when the header toggle is activated. The detail contains the next expanded state.{ expanded: boolean }

Slots

NameDescription
(default)The accordion panel content that is shown when the item is expanded.
headerOptional header content rendered in the toggle button. If omitted, the header property is used as the fallback text.

CSS Parts

NameDescription
baseThe outer wrapper for the entire accordion item.
headingThe heading (role="heading") that wraps the header button.
headerThe clickable header button that toggles the expanded state.
panelThe expandable region containing the accordion content.
panel-contentThe inner wrapper around the slotted accordion content.
nbhd-accordion-item::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-accordion-item or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

Accordion

PropertyTokenValue Copy
--nbhd-accordion-item-header-borderRadius--nbhd-border-radius-none0
--nbhd-accordion-item-header-focus-outlineOffset—-4px
--nbhd-accordion-item-header-fontSize--nbhd-typography-subheading-fontSize1.125rem
--nbhd-accordion-item-header-fontWeight--nbhd-typography-subheading-fontWeight700
--nbhd-accordion-item-header-inlineSize—100%
--nbhd-accordion-item-header-justifyContent—space-between
--nbhd-accordion-item-header-lineHeight--nbhd-typography-subheading-lineHeight1.3
--nbhd-accordion-item-header-paddingBlock--nbhd-space-416px
--nbhd-accordion-item-header-paddingInline--nbhd-space-416px
--nbhd-accordion-item-inlineSize—100%
--nbhd-accordion-item-paddingBlock--nbhd-space-00px
--nbhd-accordion-item-paddingInline--nbhd-space-00px
--nbhd-accordion-item-panel-paddingBlock--nbhd-space-416px
--nbhd-accordion-item-panel-paddingInline--nbhd-space-416px

Action plain

PropertyTokenValue Copy
--nbhd-action-plain-color--nbhd-color-action-plain-foreground#1b5e20

Dependencies

Child components <nbhd-accordion-item> renders internally. Import them too when you tree-shake.

Used by

Esc
↑ ↓ to move↵ to open