React js UI example. Frequently Asks Questions accordion

React js UI example and template, Frequently Asks Questions accordion! . Take a look at this UI example and see how it can enhance your project. Your can copy or download the code and use it in your project. Don't forget to browse our library of other free React Native templates for even more design and functionality inspiration. Happy coding!
Tags: accordion

1. First, we need fresh reactjs setup, and for that, we need to run below commands into out terminal, and also we should have latest node version installed on our system:

npx create-react-app my-awesome-project

cd my-awesome-project

npm start

2. Now we need to run below commands into our project terminal to get bootstrap and related modules into our reactjs application:

npm install [email protected] --save

npm start //For start project again

3. Finally for the main output, we need to add below code into our my-awesome-project/src/App.js file or if you have fresh setup then you can replace my-awesome-project/src/App.js file code with below code:

import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';


function App() {
  
	return (
		<div>
			<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />

<section class="ftco-section bg-light ftco-faqs">
    <div class="container">
        <div class="row">
            <div class="col-lg-6 order-md-last">
                <div class="img img-video d-flex align-self-stretch align-items-center justify-content-center justify-content-md-center mb-4 mb-sm-0" style={{/*background-image: url(https://www.bootdey.com/image/350x280/87CEFA/000000);*/}}>
                    <a href="#/" class="icon-video popup-vimeo d-flex justify-content-center align-items-center">
                        <span class="fa fa-play"></span>
                    </a>
                </div>
                <div class="d-flex mt-3">
                    <div class="img img-2 mr-md-2" style={{/*background-image: url(https://www.bootdey.com/image/240x240/FFB6C1/000000);*/}}></div>
                    <div class="img img-2 ml-md-2" style={{/*background-image: url(https://www.bootdey.com/image/240x240/20B2AA/000000);*/}}></div>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="heading-section mb-5 mt-5 mt-lg-0">
                    <h2 class="mb-3">Frequently Asks Questions</h2>
                    <p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
                </div>
                <div id="accordion" class="myaccordion w-100" aria-multiselectable="true">
                    <div class="card">
                        <div class="card-header p-0" id="headingOne">
                            <h2 class="mb-0">
                                <button href="#collapseOne" class="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link" data-parent="#accordion" data-toggle="collapse" aria-expanded="true" aria-controls="collapseOne">
                                    <p class="mb-0">How to train your pet dog?</p>
                                    <i class="fa" aria-hidden="true"></i>
                                </button>
                            </h2>
                        </div>
                        <div class="collapse show" id="collapseOne" role="tabpanel" aria-labelledby="headingOne" style={{/**/}}>
                            <div class="card-body py-3 px-0">
                                <ol>
                                    <li>Far far away, behind the word mountains</li>
                                    <li>Consonantia, there live the blind texts</li>
                                    <li>When she reached the first hills of the Italic Mountains</li>
                                    <li>Bookmarksgrove, the headline of Alphabet Village</li>
                                    <li>Separated they live in Bookmarksgrove right</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header p-0" id="headingTwo" role="tab">
                            <h2 class="mb-0">
                                <button
                                    href="#collapseTwo"
                                    class="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link collapsed"
                                    data-parent="#accordion"
                                    data-toggle="collapse"
                                    aria-expanded="false"
                                    aria-controls="collapseTwo"
                                >
                                    <p class="mb-0">How to manage your pets?</p>
                                    <i class="fa" aria-hidden="true"></i>
                                </button>
                            </h2>
                        </div>
                        <div class="collapse" id="collapseTwo" role="tabpanel" aria-labelledby="headingTwo" style={{/**/}}>
                            <div class="card-body py-3 px-0">
                                <ol>
                                    <li>Far far away, behind the word mountains</li>
                                    <li>Consonantia, there live the blind texts</li>
                                    <li>When she reached the first hills of the Italic Mountains</li>
                                    <li>Bookmarksgrove, the headline of Alphabet Village</li>
                                    <li>Separated they live in Bookmarksgrove right</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header p-0" id="headingThree" role="tab">
                            <h2 class="mb-0">
                                <button
                                    href="#collapseThree"
                                    class="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link collapsed"
                                    data-parent="#accordion"
                                    data-toggle="collapse"
                                    aria-expanded="false"
                                    aria-controls="collapseThree"
                                >
                                    <p class="mb-0">What is the best grooming for your pets?</p>
                                    <i class="fa" aria-hidden="true"></i>
                                </button>
                            </h2>
                        </div>
                        <div class="collapse" id="collapseThree" role="tabpanel" aria-labelledby="headingTwo" style={{/**/}}>
                            <div class="card-body py-3 px-0">
                                <ol>
                                    <li>Far far away, behind the word mountains</li>
                                    <li>Consonantia, there live the blind texts</li>
                                    <li>When she reached the first hills of the Italic Mountains</li>
                                    <li>Bookmarksgrove, the headline of Alphabet Village</li>
                                    <li>Separated they live in Bookmarksgrove right</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header p-0" id="headingFour" role="tab">
                            <h2 class="mb-0">
                                <button
                                    href="#collapseFour"
                                    class="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link collapsed"
                                    data-parent="#accordion"
                                    data-toggle="collapse"
                                    aria-expanded="false"
                                    aria-controls="collapseFour"
                                >
                                    <p class="mb-0">What are those requirements for sitting pets?</p>
                                    <i class="fa" aria-hidden="true"></i>
                                </button>
                            </h2>
                        </div>
                        <div class="collapse" id="collapseFour" role="tabpanel" aria-labelledby="headingTwo">
                            <div class="card-body py-3 px-0">
                                <p>
                                    Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large
                                    language ocean.
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

		</div>
	);
}
export default App;

4. Now we need to add below code into our my-awesome-project/src/App.css file :

body{margin-top:20px;}
.ftco-section {
    padding: 7em 0;
    position: relative;
}
.bg-light {
    background: #f8f9fd !important;
}
.ftco-faqs .myaccordion {
    margin: 0 auto;
    overflow: hidden;
}

.ftco-faqs .myaccordion .card,
.ftco-faqs .myaccordion .card:last-child .card-header {
    border: none;
    background: transparent;
}

.ftco-faqs .myaccordion .card-header {
    border: none;
    background: transparent;
}
.ftco-faqs .myaccordion .card-header p {
    position: relative;
    font-weight: 500;
    font-size: 18px;
    text-align: left;
}

.ftco-faqs .myaccordion .fa {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.3);
}

.ftco-faqs .myaccordion .btn {
    width: 100%;
    font-weight: 600;
    color: black;
    padding: 0;
    text-transform: capitalize;
    letter-spacing: 0;
    border-radius: 0 !important;
    margin-bottom: 10px;
    border-radius: 40px !important;
    -webkit-box-shadow: 0px 2px 8px -4px rgba(0, 0, 0, 0.21) !important;
    -moz-box-shadow: 0px 2px 8px -4px rgba(0, 0, 0, 0.21) !important;
    box-shadow: 0px 2px 8px -4px rgba(0, 0, 0, 0.21) !important;
}

.ftco-faqs .myaccordion .btn-link:hover,
.ftco-faqs .myaccordion .btn-link:focus {
    text-decoration: none;
}

.ftco-faqs button[aria-expanded="true"] {
    background-color: #00bd56;
    color: #fff !important;
}

.ftco-faqs button[aria-expanded="false"] {
    background-color: #fff;
}
.ftco-faqs .card-body {
    background: #fff;
    margin-bottom: 10px;
    border-radius: 30px;
    -webkit-box-shadow: 0px 2px 8px -4px rgba(0, 0, 0, 0.21) !important;
    -moz-box-shadow: 0px 2px 8px -4px rgba(0, 0, 0, 0.21) !important;
    box-shadow: 0px 2px 8px -4px rgba(0, 0, 0, 0.21) !important;
}


.ftco-faqs button[aria-expanded="true"] .fa {
    color: #fff !important;
}
.ftco-faqs .myaccordion .fa {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.3);
}

.ftco-faqs .myaccordion .fa {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.3);
}

.ftco-faqs [data-toggle="collapse"].collapsed .fa:before {
    content: "\f067";
    font-family: "FontAwesome";
    font-style: normal;
}

.ftco-faqs [data-toggle="collapse"] .fa:before {
    content: "\f068";
    font-family: "FontAwesome";
    font-style: normal;
}

.ftco-faqs .img {
    height: 450px;
    -webkit-box-shadow: 0px 8px 21px -10px rgba(0, 0, 0, 0.12);
    -moz-box-shadow: 0px 8px 21px -10px rgba(0, 0, 0, 0.12);
    box-shadow: 0px 8px 21px -10px rgba(0, 0, 0, 0.12);
}
.img, .blog-img, .user-img {
    width: 100%;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

.icon-video {
    width: 80px;
    height: 80px;
    background: #fff;
    -webkit-animation: pulse 2s infinite;
    animation: pulse 2s infinite;
    -webkit-box-shadow: 0px 10px 30px -4px rgba(0, 0, 0, 0.15);
    -moz-box-shadow: 0px 10px 30px -4px rgba(0, 0, 0, 0.15);
    box-shadow: 0px 10px 30px -4px rgba(0, 0, 0, 0.15);
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -ms-border-radius: 50%;
    border-radius: 50%;
}
.align-items-center {
    -webkit-box-align: center !important;
    -ms-flex-align: center !important;
    align-items: center !important;
}
.justify-content-center {
    -webkit-box-pack: center !important;
    -ms-flex-pack: center !important;
    justify-content: center !important;
}



Similar snippets

React js template and ui example accordion without border

accordion without border

React js template and ui example accordion collapse buttons

accordion collapse buttons

React js template and ui example bs4 Accordion form Wizard

bs4 Accordion form Wizard

React js template and ui example timeline with year and date

timeline with year and date

React js template and ui example bs5 dark footer

bs5 dark footer

React js template and ui example bs4 crud users

bs4 crud users

React js template and ui example invoice with client info description amount and pay now button

invoice with client info description amount and pay now button