RadixDVD.com

Bootstrap Accordion Form

Intro

Web pages are the very best area to showcase a amazing ideas and also attractive content in quite cheap and easy approach and have them provided for the entire world to observe and get familiar with. Will the web content you've published get audience's passion and attention-- this stuff we can never ever know till you actually bring it live to web server. We can however suspect with a relatively serious chance of being right the effect of several features over the visitor-- judging probably from our unique prior experience, the good practices defined over the internet or most typically-- by the manner a webpage impacts ourselves while we're giving it a good shape during the development process. One point is clear yet-- great spaces of clear text are really possible to bore the site visitor and also move the customer away-- so what exactly to produce in cases where we simply just wish to put this kind of much larger amount of content-- for example conditions , frequently asked questions, practical options of a goods or a professional service which ought to be revealed and exact and so on. Well that is definitely what the design process itself narrows down in the end-- obtaining working options-- and we should really uncover a way working this out-- showcasing the web content needed in intriguing and desirable approach nevertheless it could be 3 webpages plain text long.

A good technique is enclosing the content into the so called Bootstrap Accordion Group element-- it offers us a powerful way to feature just the explanations of our text clickable and present on page so typically the whole information is available at all times within a small space-- usually a single screen so the customer may easily click on what is essential and have it enlarged to get familiar with the detailed material. This solution is definitely as well natural and web format since small acts need to be taken to keep on doing the job with the web page and so we have the visitor progressed-- kind of "push the tab and see the light flashing" stuff.

How you can utilize the Bootstrap Accordion Example:

Accordion example

Increase the default collapse behaviour to create an Bootstrap Accordion Example.

Accordion  scenario

Accordion  good example
Accordion  good example
<div id="accordion" role="tablist" aria-multiselectable="true">
  <div class="card">
    <div class="card-header" role="tab" id="headingOne">
      <h5 class="mb-0">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </a>
      </h5>
    </div>

    <div id="collapseOne" class="collapse show" role="tabpanel" aria-labelledby="headingOne">
      <div class="card-block">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" role="tab" id="headingTwo">
      <h5 class="mb-0">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </a>
      </h5>
    </div>
    <div id="collapseTwo" class="collapse" role="tabpanel" aria-labelledby="headingTwo">
      <div class="card-block">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" role="tab" id="headingThree">
      <h5 class="mb-0">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </a>
      </h5>
    </div>
    <div id="collapseThree" class="collapse" role="tabpanel" aria-labelledby="headingThree">
      <div class="card-block">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>

Within Bootstrap 4 we have the fantastic tools for creating an accordion quick and very easy employing the newly presented cards elements incorporating just a few additional wrapper features. Listed here is how: To begin setting up an accordion we initially really need an element in order to wrap the whole item in-- create a

<div>
element and assign it an ID-- something like
id="MyAccordionWrapper"
or so attribute. ( read more)

Next step it is undoubtedly time to set up the accordion sections-- provide a

.card
element, inside it-- a
.card-header
to develop the accordion headline. In the header-- put in an original headline like
h1-- h6
with the
. card-title
class selected and in this heading wrap an
<a>
element to certainly have the heading of the section. For you to control the collapsing section we are actually about to establish it really should have
data-toggle = "collapse"
attribute, its target needs to be the ID of the collapsing component we'll generate in a minute such as
data-target = "long-text-1"
for instance and lastly-- to make confident just one accordion feature stays enlarged at once we really should additionally bring in a
data-parent
attribute indicating the master wrapper with regard to the accordion in our case it really should be
data-parent = "MyAccordionWrapper"

An additional case

Another  scenario
<!DOCTYPE html>
<title>My Example</title>

<!-- Bootstrap 4 alpha CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="sha384-2hfp1SzUoho7/TsGGGDaFdsuuDL0LX2hnUp6VkX3CUQ2K4K+xjboZdsXyp4oUHZj" crossorigin="anonymous">
<style>
body 
padding-top: 1em;
 
</style>
<div class="container-fluid">
    
<div id="faq" role="tablist" aria-multiselectable="true">

<div class="card">
<div class="card-header" role="tab" id="questionOne">
<h5 class="card-title">
<a data-toggle="collapse" data-parent="#faq" href="#answerOne" aria-expanded="false" aria-controls="answerOne">
What if my boots are too big for my feet?
</a>
</h5>
</div>
<div id="answerOne" class="collapse" role="tabcard" aria-labelledby="questionOne">
<div class="card-block">
Stuff your boots with newspaper or tissue.
</div>
</div>
</div>

<div class="card">
<div class="card-header" role="tab" id="questionTwo">
<h5 class="card-title">
<a class="collapsed" data-toggle="collapse" data-parent="#faq" href="#answerTwo" aria-expanded="false" aria-controls="answerTwo">
Can I wear my boots inside?
</a>
</h5>
</div>
<div id="answerTwo" class="collapse" role="tabcard" aria-labelledby="questionTwo">
<div class="card-block">
No. Your mama should've told you about this.
</div>
</div>
</div>

<div class="card">
<div class="card-header" role="tab" id="questionThree">
<h5 class="card-title">
<a class="collapsed" data-toggle="collapse" data-parent="#faq" href="#answerThree" aria-expanded="true" aria-controls="answerThree">
What if my boots get slippery when wet?
</a>
</h5>
</div>
<div id="answerThree" class="collapse in" role="tabcard" aria-labelledby="questionThree">
<div class="card-block">
Keep your boots dry.
</div>
</div>
</div>

</div>

</div>
    
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>

<!-- Tether -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>

<!-- Bootstrap 4 Alpha JS -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js" integrity="sha384-VjEeINv9OSwtWFLAtmc4JCtEJXXBub00gtSnszmspDLCtC0I4z4nqz7rEFbIZLLU" crossorigin="anonymous"></script>

<!-- Initialize Bootstrap functionality -->
<script>
// Initialize tooltip component
$(function () 
  $('[data-toggle="tooltip"]').tooltip()
)

// Initialize popover component
$(function () 
  $('[data-toggle="popover"]').popover()
)
</script>

Whenever this is completed it is undoubtedly moment for creating the component which will certainly stay hidden and keep the current information behind the heading. To carry out this we'll wrap a

.card-block
in a
.collapse
component together with an ID attribute-- the same ID we must put as a target for the url in the
.card-title
from above-- for the example it really should be like
id ="long-text-1"

Once this format has been generated you can set either the plain text or else additional wrap your content generating a bit more complex system. ( more info)

Improved content

Repeating the training from above you can provide as many features to your accordion just as you require to. And if you desire a material element to show enlarged-- specify the

.in
or
.show
classes to it baseding upon the Bootstrap 4 build version you're dealing with-- up to Alpha 5 the
.in
class proceeds and inside of Alpha 6 it becomes removed and replaced by
.show

Final thoughts

So basically that's ways in which you can easily deliver an completely working and pretty great looking accordion having the Bootstrap 4 framework. Do note it employs the card element and cards do extend the entire space available by default. In this way mixed along with the Bootstrap's grid column methods you can conveniently generate complex pleasing layouts inserting the whole stuff within an element with specified amount of columns width.

Review some video guide about Bootstrap Accordion

Linked topics:

Bootstrap accordion approved documentation

Bootstrap acoordion  authoritative documentation

How to make a Bootstrap v4 accordion collapse when clicking the whole header div?

How to make a Bootstrap v4 accordion collapse when clicking the whole header div?

GitHub:Collapse Accordion is still using Panels

GitHub:Collapse Accordion is still using Panels