Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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:


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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(