Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Link/Button in Accordion Header


Hello Team,

Is there any way where we can add a link/button to the accordion header?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Hi,

Could you please describe in more detail what you are trying to achieve?

You can check bootstrap accordion doc page:
https://getbootstrap.com/docs/5.0/components/accordion/

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Hello,

I am trying to add a clickable button to the accordion header after the title is there any way I can achieve this?



Hi,

You can add a button outside of the accordion header.

<div class="mb-5">
<div class="d-flex">
<div
class="py-3 me-5 d-flex"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion"
>
<span class="accordion-icon">
<span class="svg-icon svg-icon-3">
<inline-svg src="media/icons/duotune/arrows/arr064.svg" />
</span>
</span>
<h3 class="fs-4 text-gray-800 fw-bold mb-0 ms-4">
Accordion header text

</div>
<button
@click.stop="buttonClick()"
data-bs-parent="#myGroup"
class="btn btn-xs btn-primary"
>
You button
</button>
</div>

<div

class="fs-6 collapse show ps-10"
data-bs-parent="#kt_accordion"
>
Accordion content
</div>
</div>


Regards,
Lauris Stepanovs,
Keenthemes Support Team



Hello,

Thanks for the reply!

Is it possible to add links/buttons to this accordion?

https://preview.keenthemes.com/html/metronic/docs/base/accordion#basic



Hi,

Yes, you can achieve this as shown below.

<!--begin::Accordion-->
<div class="accordion" >
<div class="accordion-item">
<h2 class="accordion-header" >
<div
class="accordion-button fs-4 fw-semibold"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_1"
aria-expanded="true"
aria-controls="kt_accordion_1_body_1"
>
Accordion Item #1

<button data-bs-toggle="collapse" @click="buttonClick()">
You button text
</button>
</div>
</h2>
<div

class="accordion-collapse collapse show"
aria-labelledby="kt_accordion_1_header_1"
data-bs-parent="#kt_accordion_1"
>
<div class="accordion-body">...</div>
</div>
</div>
</div>
<!--end::Accordion-->


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(