Home > CMS- Content Management System > Sharepoint > How to Create a Basic Accordion SharePoint Hosted Add-in

How to Create a Basic Accordion SharePoint Hosted Add-in

This post was most recently updated on July 31st, 2024

In this article, we are going to make a Basic Accordion SharePoint Hosted Add-in, built with HTML, CSS and jQuery. These type of add-ins are mostly used in FAQ’s where we have Question and Answers. 

Before start on an Accordion I request to go through the other SharePoint Add-in articles in this series to get more information. So it gives you basic idea about SharePoint add-in.

So we assume that you have reasonable knowledge of SharePoint Hosted Add-in, HTML, CSS and jQuery. We will create a simple Basic Accordion SharePoint app with Custom App List. We will show Accordion content from Accordion Custom list.

Table of Contents

  1. Go to Basic Accordion Add-in Project
  2. Go to Create an Accordion List
  3. Go to Create a Style file
  4. Go to Create a Basic Accordion.aspx Page

You might also like: How to add and read SharePoint Hosted custom Add-In Properties

Create Basic Accordion Add-in Project

To create a Basic Accordion Add-in please read How to create Hello World SharePoint Hosted Add-in and follow given instruction to create a basic Add-in.

So Next is 

Create an Accordion List

  1. Go to Accordion App Solution Explorer and Right Click on App Solution , Navigate to Add option and then Click On New Item.
    New List
  2. Go to Office/SharePoint > List, Create a New Custom List and Click on Add.
    Custom List Name
  3. In SharePoint List Wizard settings choose Custom List option and Click on Finish. If you want to use existing list template you can go with existing list template setting options. In this scenario I choose Custom List option.
    SharePoint List Customization Wizard
  4. Under Columns Tab create Title (default column) and Description (available column ) column with Single Line of Text and Multi lines of Text column type, Mark both column required. You can also check the structure of Custom list on Right Hand side.
    Accordion List
    You can remove column Clicking on Star icon from list. The list also provide some pre-defined column.

    List Columns

Create a Style File

I created style and script for Accordion App and added app.css also I created new folder for script and added app.js.

  1. To Create a Styles folder, Go to Accordion App Solution Explorer and Right Click on App Solution , Navigate to Add option and Click On New Folder.
  2. To Create custom style file within styles folder, Go to Accordion App Solution Explorer >Styles and Right Click on styles, Navigate to Add option and Click On New Item. Select Web option and click on Style Sheet item and it will crate .css file under Styles. 

Create a Basic Accordion.aspx Page

I created new basic Page in Add-in place of existing Default page.You can set Basic Accordion.aspx Page as a Start Page of App from AppMainfest file.

  1. To Create a Page in SharePoint add-in Go to Accordion App Solution Explorer and Right Click on Pages folder, Navigate to Add option and Click On New Item.
  2. Go to Office/SharePoint > Page, Create a New Page and Click on Add.

Add your script and style in PageHead placeholder and add given HTML in PlaceHolderMain Area placeholder.

Basic Accordion Page

I’ve used comments to organized code. Add below snippet code in your respective files and then deploy and install the app.

Note:  Set permission Read against scope Web in AppMainfest file.For more information about add-in permissions, please see the Add-in permissions

The CSS Styling 

The jQuery Functionality

The HTML structure 

The Accordion List Content

Add Data in Accordion List by clicking on New Item button. You can access Accordion List with following below URL pattern. 

Accordion List Data

The Basic Accordion App Output

Basic Accordion Page

Further reading of this series:

How to create Hello World SharePoint Hosted Add-in

About add-in permissions in SharePoint Hosted Add-Ins

What is the Host Web URL and App Web URL in SharePoint add-in?

What is Manifest file in SharePoint Add-In?

Hope you find it helpful. If you liked this article, then please share and comment.

This Article is TAGGED in , , , , . BOOKMARK THE permalink.

Avatar photo
Chintan Upadhayay
I am a senior web developer with more than 4+ years experience in WordPress, PHP, MySQL, HTML, CSS, jQuery and other web technologies. I am the beginner in SharePoint and Learning SharePoint.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">