Open In App

Spectre Accordions

Last Updated : 13 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The Spectre Accordions provide simple accordion by extending the panel component. The use of the data-parent attribute to makes sure that all collapsible elements under the specified parent will be closed when one of the collapsible items is display.

Alternatively, you can use details and summary instead of input radio or checkbox trick. Add the open attribute to details to expand it. Microsoft Edge support is under consideration. 

Spectre Accordions Class:

  • accordion: This class used to create the accordion elements.

Note: You need to include the accordion-1 as an id in the input field where you will attach the icon for down fall.

Syntax:

 <div class="accordion">
 ...
 </div>

Below example illustrate the example of Spectre Accordion:

Example:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <link rel="stylesheet"
        href=
    <link rel="stylesheet"
        href=
    <link rel="stylesheet"
        href=
</head>
 
<body>
    <center>
    <h1 class="text-success">GeeksforGeeks</h1>
    <strong>SPECTRE Accordion Class</strong>
    <br><br>
    <div class="accordion">
      <input type="checkbox"
             id="accordion-1"
             hidden>
      <label class="accordion-header"
             for="accordion-1">
        <i class="icon icon-arrow-right mr-1"></i>
        Geeksforgeeks
      </label>
      <div class="accordion-body">
         
<p>
           Image result for Geeksforgeeks description
           We provide a variety of services for you to
           learn, thrive and also have fun! Free Tutorials,
           Millions of Articles, Live, Online and Classroom
           Courses ,Frequent Coding Competitions ,Webinars
           by Industry Experts, Internship opportunities and
           Job Opportunities. Knowledge is power!
        </p>
 
 
      </div>
    </div>
    </center>
</body>
 
</html>


Output:

Spectre Accordions

Spectre Accordions

Reference: https://picturepan2.github.io/spectre/components/accordions.html



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads