Accordion
An accordion is a list of headers that hide or reveal additional content when selected.
This component requires the following JavaScript plugin:
Examples
Default
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxCongress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
No Soldier shall, in time of peace be quartered in any house, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offence to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
Multiselectable
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxCongress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
No Soldier shall, in time of peace be quartered in any house, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offence to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
Bordered
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxCongress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
No Soldier shall, in time of peace be quartered in any house, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offence to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
Component API
Accordions are made up of 4 primary elements:
Root
-
x-accordion
Custom Alpine directive that marks the Accordion Root.
Item
-
x-accordion:item
Custom Alpine directive that marks a single Accordion Item.
Trigger
-
x-accordion:trigger
Custom Alpine directive that marks the Accordion Trigger.
-
aria-controls
Type:
string
Accessibility attribute that links the Accordion Trigger control to it’s respective Accordion Content.
Automatically handled with JavaScript.
-
aria-expanded
Type:
boolean
Accessibility attribute that communicates whether an element is expanded or collapsed.
Automatically handled with JavaScript.
Content
-
x-accordion:content
Custom Alpine directive that marks the Accordion Content.
-
id
Type:
string
Links the Accordion Content to it’s respective Accordion Trigger.
Automatically handled with JavaScript.
-
hidden
Type:
'until-found' | false
Handles the visibility of the Accordion Content. When
until-found
, content will be hidden but discoverable to browser search. Whenfalse
, content will be visible andhidden
attribute will be removed.Automatically handled with JavaScript.
Keyboard Interactions
-
Enter or Space
When focus is on an Accordion Item for a collapsed panel, expands the associated panel. If the implementation allows only one panel to be expanded, the previously expanded panel is collapsed.
-
Tab
Moves focus to the next focusable element. All Accordion Items in the Accordion List must be included in the page Tab sequence.
-
Down Arrow
If focus is on an Accordion Item, moves focus to the next Accordion Item. If focus is on the last Accordion Item, moves focus to the first Accordion Item.
-
Shift + Tab
Moves focus to the previous focusable element. All Accordion Items in the Accordion List must be included in the page Tab sequence.
-
Up Arrow
If focus is on an Accordion Item, moves focus to the previous Accordion Item. If focus is on the first Accordion Item, moves focus to the last Accordion Item.
-
Home or fn + Left Arrow (Mac)
If focus is on an Accordion Item, moves focus to the first Accordion Item.
-
End or fn + Right Arrow (Mac)
If focus is on an Accordion Item, moves focus to the last Accordion Item.