lightdarkdefaultcompact
Getting StartedInstallationChangelogSupportGithubFrameworksAngularVueReactDemosFoundationThemesInternationalizationTypographyIconsPopoversLayoutGetting StartedBlockInlineGridComponentsAccordionAlertAlert GroupBadgeBreadcrumbButtonButton GroupButton ExpandButton HandleButton IconButton ResizeButton SortCardChatCheckboxColorData GridDateDialogDividerDrawerDropdownFileFormat DatetimeFormat NumberFormsForm InteractionsForm ValidationHeaderInputMenuMonthNavPaginationPasswordProgress BarProgress CircleProgress DotRadioRangeRatingSearchSelectStepperSwitchTabsTagTextareaTimeToastToggletipTooltipTreeData GridGetting StartedFooterPlaceholderAsyncResponsiveHeightPaginationBordersHoverLayerRange SelectionCSVColumn AlignmentColumn WidthColumn FixedColumn StickyColumn VisibilityColumn GroupsColumn SpanColumn ResizeDraggable ColumnsDraggable RowsRow HeaderRow Multi SelectRow Single SelectRow HeightRow ActionRow Action BulkRow StickyRow StripeRow FixedRow SortRow Groups

The accordion component is used to display a large amount of content in a small space. The accordion should be used to group related content together. The titles or headings of the accordion sections should be clear and concise, describing the content that will be revealed.

Example

Expanded accordion panel

Expanded accordion content

Disabled accordion header

Disabled accordion content

Collapsed accordion

Collapsed accordion content

code
<script type="module">
  import '@blueprintui/components/include/accordion.js';
</script>

<bp-accordion>
  <bp-accordion-panel expanded>
    <bp-accordion-header>Expanded accordion panel</bp-accordion-header>
    <bp-accordion-content>
      <p bp-text="content">Expanded accordion content</p>
    </bp-accordion-content>
  </bp-accordion-panel>
  <bp-accordion-panel>
    <bp-accordion-header disabled>Disabled accordion header</bp-accordion-header>
    <bp-accordion-content>
      <p bp-text="content">Disabled accordion content</p>
    </bp-accordion-content>
  </bp-accordion-panel>
  <bp-accordion-panel>
    <bp-accordion-header>Collapsed accordion</bp-accordion-header>
    <bp-accordion-content>
      <p bp-text="content">Collapsed accordion content</p>
    </bp-accordion-content>
  </bp-accordion-panel>
</bp-accordion>

Install

NPM

// npm package
import '@blueprintui/components/include/accordion.js';

CDN

<script type="module">
  import 'https://cdn.jsdelivr.net/npm/@blueprintui/components/include/accordion.js/+esm';
</script>

Accessibility

  • Use clear, descriptive titles or headings for the accordion sections.
  • Ensure keyboard navigation order is not disrupted.
  • Provide an alternative way for users to access the content in the accordion sections, such as a "show all" or "expand all" button.

bp-accordion

Properties

NameTypesDescription
accessordetermines the visual layer style (container vs flat for nesting)
layer'flat' | 'container'

Attributes

NameTypesDescription
accessordetermines the visual layer style (container vs flat for nesting)

CSS Properties

NameTypesDescription
--border-color
--border-width
--border-radius

Slots

NameTypesDescription
defaultslot for accordion panels

bp-accordion-panel

Properties

NameTypesDescription
accessordetermine if element is expanded
expandedboolean

Attributes

NameTypesDescription
accessordetermine if element is expanded

Slots

NameTypesDescription
defaultslot for header and content
bp-accordion-header
bp-accordion-content

bp-accordion-header

Properties

NameTypesDescription
expandedboolean
pressedboolean
selectedboolean
readonlyboolean
disabledboolean
type'button' | 'submit'
namestringrepresents the name of the current
element as a string.
valuestring
popoverTargetElementHTMLElement
popoverTargetAction| 'toggle' | 'show' | 'hide'
popovertargetstring
formHTMLFormElement
formActionstring
formEnctypestring
formMethodstring
formNoValidateboolean
formTargetstring
labelsNodeListOf
validationMessagestring
validityValidityState
willValidateboolean
checkValidityany
reportValidityany
setCustomValidityany
formAssociatedboolean

Attributes

NameTypesDescription
accessordetermines the current value
popovertargetactiondetermines the current value
popovertargetdetermines the current value

CSS Properties

NameTypesDescription
--background
--color
--font-size
--padding

Slots

NameTypesDescription
defaultslot for header content

bp-accordion-content

Properties

NameTypesDescription

CSS Properties

NameTypesDescription
--color
--font-size
--font-weight
--background

Slots

NameTypesDescription
defaultslot for content