Active button is always active inside button-group


Topic: Active button is always active inside button-group

Joachim Schneider pro premium priority asked 3 years ago

Expected behavior When I click on the 2nd button inside a button-group, the active button should become inactive.

Actual behavior The "Button1" stays active when the 2nd button is clicked.

Example

<div class="btn-group shadow-1" role="group">
  <button href="#!" class="btn btn-link active">Button1</button>
  <button href="#!" class="btn btn-link">Button2</button>
  <button href="#!" class="btn btn-link">Button3</button>
</div>

Is there a an other way to pre-select a button inside a button-group?

Thanks a lot


Michał Duszak staff answered 3 years ago

Hello, the behaviour you described matches Radio buttons https://mdbootstrap.com/snippets/standard/m-duszak/3256739


Joachim Schneider pro premium priority commented 3 years ago

Thanks, this works as expected.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: Web
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No