Accordion Component: Difference between revisions
No edit summary |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
The | {{DrupalBack}} | ||
The '''Accordion''' component allows you to create collapsible and expandable sections of content on your site. | |||
== Elements == | == Elements == | ||
# Accordion Component - Title | # Accordion Component - Title | ||
## Toggle | ## Toggle '''Show Title''' to set the visibility of the component title. | ||
# Accordion Item - Title | # Accordion Item - Title | ||
## Toggle | ## Toggle '''Initial State''' to set the accordion item to '''Open''' or '''Closed''' on page load. | ||
## Set '''Order''' | ## Set '''Order''' to rearrange the display order of individual accordion items. | ||
# Accordion Item - Content | # Accordion Item - Content | ||
{{Screenshot|Screenshot 2025-03-05 at 12.49.20 PM.png|800px|Diagram showing the fields that make up the Accordion component.|The Accordion component fields.}} | |||
== Examples == | == Examples == | ||
{{Callout|type=tip|title=Interactive Example|content=The preview below shows the Accordion component using its default configuration. | |||
{{ | |||
To experiment with different layouts and other settings, open the interactive component playground. | |||
'''[https://toolkit.swarthmore.edu/?path=/story/swarthmore-theme-components-accordion Open Component Playground]'''}} | |||
{{StorybookComponent|id=swarthmore-theme-components-accordion|height=650}} | |||
== Step-by-step Instructions == | |||
# Add a '''Title''' for the accordion component. Toggle '''Show Title''' to control whether the component title is displayed. | |||
# Add an '''Accordion Item''' to the component: | |||
## Add a '''Title'''. | |||
## Toggle '''Initial State''' to determine whether the item displays as '''Open''' or '''Closed''' when the page first loads. | |||
## Add text to the '''Content''' field. This will become the main body of the accordion item. | |||
## Optionally, set an '''Order''' value to rearrange the display order of the accordion item. Lower values appear first. | |||
# Add as many additional accordion items as needed by clicking '''Add Accordion Item'''. | |||
[[Category:Drupal]] | |||
Latest revision as of 13:06, 10 July 2026
The Accordion component allows you to create collapsible and expandable sections of content on your site.
Elements
- Accordion Component - Title
- Toggle Show Title to set the visibility of the component title.
- Accordion Item - Title
- Toggle Initial State to set the accordion item to Open or Closed on page load.
- Set Order to rearrange the display order of individual accordion items.
- Accordion Item - Content
Examples
Interactive Example
The preview below shows the Accordion component using its default configuration.
To experiment with different layouts and other settings, open the interactive component playground.
Open Component Playground
Step-by-step Instructions
- Add a Title for the accordion component. Toggle Show Title to control whether the component title is displayed.
- Add an Accordion Item to the component:
- Add a Title.
- Toggle Initial State to determine whether the item displays as Open or Closed when the page first loads.
- Add text to the Content field. This will become the main body of the accordion item.
- Optionally, set an Order value to rearrange the display order of the accordion item. Lower values appear first.
- Add as many additional accordion items as needed by clicking Add Accordion Item.
