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
layer'flat' | 'container'determines the visual layer style (container vs flat for nesting)

Attributes

NameTypesDescription
layer'flat' | 'container'determines 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
expandedbooleandetermine if element is expanded

Attributes

NameTypesDescription
expandedbooleandetermine if element is expanded

Slots

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

bp-accordion-header

Properties

NameTypesDescription
pressedbooleanturns the button into a toggle button
selectedbooleanindicate the current "selected" state of various widgets
readonlybooleanmakes the element not mutable, meaning the user can not interact with button
disabledbooleandetermines if element is mutable or focusable
type'button' | 'submit'default behavior of the button
namestringrepresents the name of the current
element as a string.
valuestringdetermines the current value
popoverTargetElementHTMLElement
popoverTargetAction| 'toggle' | 'show' | 'hide'
popovertargetstring
formHTMLFormElement
formActionstring
formEnctypestring
formMethodstring
formNoValidateboolean
formTargetstring
labelsNodeListOf
validationMessagestring
validityValidityState
willValidateboolean
checkValidityany
reportValidityany
setCustomValidityany
formAssociatedboolean

Attributes

NameTypesDescription
pressedbooleanturns the button into a toggle button
selectedbooleanindicate the current "selected" state of various widgets
expandedbooleanindicate if a control is expanded or collapsed
readonlybooleanmakes the element not mutable, meaning the user can not interact with button
disabledbooleandetermines if element is mutable or focusable
type'button' | 'submit'default behavior of the button
valuestringdetermines the current value
popoverTargetElementHTMLElement
popovertargetaction| 'toggle' | 'show' | 'hide'
popovertargetstring

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