Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pure css button (group) toggle #25185

Closed
wants to merge 8 commits into from

Conversation

ysds
Copy link
Member

@ysds ysds commented Jan 3, 2018

This PR add pure CSS toggle button.

The button plugin will be no longer need, but this allows available both JS and pure css.

Button Plugin:

<button type="button" class="btn btn-secondary" data-toggle="button" aria-pressed="false" autocomplete="off">
  Single toggle
</button>

Pure CSS (Required new .btn-group-input class):

<div class="btn-group">
  <input type="checkbox" class="btn-group-input" id="checkbox1">
  <label class="btn btn-primary" for="checkbox1">Single toggle</label>
</div>

Demo: https://codepen.io/fellows3/pen/bQydEm

Fixes #25122
Fixes #27600

@ysds ysds changed the title Add pure css button group toggle Add pure css button (group) toggle Jan 3, 2018
@mdo
Copy link
Member

mdo commented Jan 3, 2018

Required new .btn-group-input class

That's likely a deal breaker on this being in v4 as an update to the existing button group. We'd have to deprecate the existing one and provide this as a new component. Breaking changes are a no-go heading into stable v4.0.

@ysds
Copy link
Member Author

ysds commented Jan 3, 2018

I added .btn-group-input as a class similar to .custom-control-input, but It can be realized without .btn-group-input by complicating CSS.

.btn-group-input { ... }

to

.btn-group > input[type="radio"],
.btn-group > input[type="checkbox"] { ... }
<div class="btn-group">
  <input type="checkbox" id="checkbox1">
  <label class="btn btn-primary" for="checkbox1">Single toggle</label>
</div>

@patrickhlauke
Copy link
Member

i'd like to see this addressed in 4.1 perhaps though. toggle groups are extremely brittle due to their reliance on JS which makes them easily go out of sync with things like keyboard behavior, autofill behavior, etc

@ysds
Copy link
Member Author

ysds commented Jan 13, 2018

x-ref: #25281

@XhmikosR XhmikosR requested a review from a team as a code owner November 4, 2018 20:22
@MartijnCuppens
Copy link
Member

I like this, but maybe we better move this to v5? Otherwise we'll have 2 implementations of the same component. @mdo, what do you think?

@mdo mdo changed the base branch from v4-dev to master February 14, 2019 16:58
@mdo mdo removed the v4 label Feb 14, 2019
@mdo
Copy link
Member

mdo commented Mar 12, 2019

Superseded by #28463.

@mdo mdo closed this Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants